From 095e2c48271a5248c8711a4e6a34bcb4d44c440e Mon Sep 17 00:00:00 2001 From: Anoop C S Date: Wed, 10 Feb 2016 17:08:26 +0530 Subject: 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 Reviewed-on: http://review.gluster.org/13423 Smoke: Gluster Build System NetBSD-regression: NetBSD Build System CentOS-regression: Gluster Build System Reviewed-by: jiffin tony Thottan Reviewed-by: Niels de Vos --- api/src/glfs-fops.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'api') 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); -- cgit