diff options
| -rw-r--r-- | api/src/glfs-fops.c | 10 | 
1 files changed, 9 insertions, 1 deletions
diff --git a/api/src/glfs-fops.c b/api/src/glfs-fops.c index 722cd5e2736..5c15df0490b 100644 --- a/api/src/glfs-fops.c +++ b/api/src/glfs-fops.c @@ -446,15 +446,18 @@ pub_glfs_lseek (struct glfs_fd *glfd, off_t offset, int whence)  {  	struct stat sb = {0, };  	int         ret = -1; +        off_t       off = -1;  	__glfs_entry_fd (glfd);  	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); @@ -464,9 +467,14 @@ pub_glfs_lseek (struct glfs_fd *glfd, off_t offset, int whence)  		}  		glfd->offset = sb.st_size + offset;  		break; +        default: +                errno = EINVAL;  	} -	return glfd->offset; +        if (ret != -1) +                off = glfd->offset; + +        return off;  }  GFAPI_SYMVER_PUBLIC_DEFAULT(glfs_lseek, 3.4.0);  | 
