diff options
author | Barak Sason Rofman <bsasonro@redhat.com> | 2020-05-07 18:57:37 +0300 |
---|---|---|
committer | Barak Sason Rofman <sason922@gmail.com> | 2020-05-07 23:04:32 +0300 |
commit | a902e4aafed378e222d72603acbfe3edfb479916 (patch) | |
tree | 7cff6b4bfa85307c7b1e15ea957db42579e9c4ef /libglusterfs/src | |
parent | b85f01abab658d1d704cd6caf84dd64eddafbff7 (diff) |
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 <bsasonro@redhat.com>
Diffstat (limited to 'libglusterfs/src')
-rw-r--r-- | libglusterfs/src/syncop.c | 11 |
1 files changed, 6 insertions, 5 deletions
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 |