summaryrefslogtreecommitdiffstats
path: root/api
diff options
context:
space:
mode:
authorAnoop C S <anoopcs@redhat.com>2016-02-10 17:08:26 +0530
committerNiels de Vos <ndevos@redhat.com>2016-02-11 02:59:39 -0800
commit095e2c48271a5248c8711a4e6a34bcb4d44c440e (patch)
tree7a444246673189bef1ba851eeb1345c62eafaf6c /api
parent444378de64f398c4e19468e83ac31fccc0a94800 (diff)
api: glfs_lseek must return repositioned offset for SEEK_SET, SEEK_CUR flags
On success, glfs_lseek() API is responsible for providing the repositioned offset as its return value. But for SEEK_SET and SEEK_CUR flags, glfs_lseek() returns -1 on successfully repositioning the fd offset. Current change is to set ret to 0 after glfd->offset is modified correctly so as to return the correct offset. Change-Id: I94d582779a98074cf633289f4b60b3c6a04e4f18 BUG: 1306264 Signed-off-by: Anoop C S <anoopcs@redhat.com> Reviewed-on: http://review.gluster.org/13423 Smoke: Gluster Build System <jenkins@build.gluster.com> NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org> CentOS-regression: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: jiffin tony Thottan <jthottan@redhat.com> Reviewed-by: Niels de Vos <ndevos@redhat.com>
Diffstat (limited to 'api')
-rw-r--r--api/src/glfs-fops.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/api/src/glfs-fops.c b/api/src/glfs-fops.c
index 15ac1f2a799..cc972a41e7c 100644
--- a/api/src/glfs-fops.c
+++ b/api/src/glfs-fops.c
@@ -624,9 +624,11 @@ pub_glfs_lseek (struct glfs_fd *glfd, off_t offset, int whence)
switch (whence) {
case SEEK_SET:
glfd->offset = offset;
+ ret = 0;
break;
case SEEK_CUR:
glfd->offset += offset;
+ ret = 0;
break;
case SEEK_END:
ret = pub_glfs_fstat (glfd, &sb);