From a902e4aafed378e222d72603acbfe3edfb479916 Mon Sep 17 00:00:00 2001 From: Barak Sason Rofman Date: Thu, 7 May 2020 18:57:37 +0300 Subject: posix - fix seek functionality A wrong pointer check causes the offset returned by seek to be always wrong fixes: #1228 Change-Id: Iac4c6a163175617ac4f14544fc6b7c6fb4041cd6 Signed-off-by: Barak Sason Rofman --- libglusterfs/src/syncop.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'libglusterfs') diff --git a/libglusterfs/src/syncop.c b/libglusterfs/src/syncop.c index 0de53c6f4cf..693970f0f30 100644 --- a/libglusterfs/src/syncop.c +++ b/libglusterfs/src/syncop.c @@ -2881,12 +2881,13 @@ syncop_seek(xlator_t *subvol, fd_t *fd, off_t offset, gf_seek_what_t what, SYNCOP(subvol, (&args), syncop_seek_cbk, subvol->fops->seek, fd, offset, what, xdata_in); - if (*off) - *off = args.offset; - - if (args.op_ret == -1) + if (args.op_ret < 0) { return -args.op_errno; - return args.op_ret; + } else { + if (off) + *off = args.offset; + return args.op_ret; + } } int -- cgit