From: Ralph Boehme Date: Sun, 24 Nov 2024 07:23:36 +0000 (+0100) Subject: vfs: implement POSIX append-IO in vfs_pwrite_data() X-Git-Tag: tdb-1.4.13~218 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=9c41e36af7e136db4eb85c29c555192965b3c371;p=thirdparty%2Fsamba.git vfs: implement POSIX append-IO in vfs_pwrite_data() This basically just avoids clobbering a possible offset=VFS_PWRITE_APPEND_OFFSET when calling SMB_VFS_PWRITE(). Signed-off-by: Ralph Boehme Reviewed-by: Jeremy Allison --- diff --git a/source3/smbd/vfs.c b/source3/smbd/vfs.c index 76732691c09..c5be257c0d3 100644 --- a/source3/smbd/vfs.c +++ b/source3/smbd/vfs.c @@ -520,9 +520,14 @@ ssize_t vfs_pwrite_data(struct smb_request *req, } while (total < N) { - ret = SMB_VFS_PWRITE(fsp, buffer + total, N - total, - offset + total); - + off_t pwrite_offset = offset; + if (offset != VFS_PWRITE_APPEND_OFFSET) { + pwrite_offset += total; + } + ret = SMB_VFS_PWRITE(fsp, + buffer + total, + N - total, + pwrite_offset); if (ret == -1) return -1; if (ret == 0)