0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-11-17 15:30:52 +01:00

ircd::fs: Improve condition for RWF_APPEND/pwritev2() -1 offset value.

This commit is contained in:
Jason Volk 2019-03-15 18:45:39 -07:00
parent 4efb3a26fd
commit 20716634a8

View file

@ -821,20 +821,16 @@ ircd::fs::append(const string_view &path,
// the -1. Otherwise, we don't keep flags in userspace and we // the -1. Otherwise, we don't keep flags in userspace and we
// don't check the fd for whether it was opened with O_APPEND // don't check the fd for whether it was opened with O_APPEND
// so the user may just have to eat the cost of an extra lseek(). // so the user may just have to eat the cost of an extra lseek().
#ifdef HAVE_PWRITEV2 #if defined(HAVE_PWRITEV2) && defined(RWF_APPEND)
size_t size_t
ircd::fs::append(const fd &fd, ircd::fs::append(const fd &fd,
const const_buffers &bufs, const const_buffers &bufs,
const write_opts &opts_) const write_opts &opts_)
{ {
auto opts(opts_); auto opts(opts_);
#if defined(RWF_APPEND)
if(support_append) if(support_append)
opts.offset = -1; opts.offset = -1;
#endif else if(!opts.offset || opts.offset == -1)
if(!opts.offset)
opts.offset = syscall(::lseek, fd, 0, SEEK_END); opts.offset = syscall(::lseek, fd, 0, SEEK_END);
return write(fd, bufs, opts); return write(fd, bufs, opts);