erofs-utils: fix erofs_sys_lsetxattr() returning positive errno
PATCH 1/1 erofs-utils: fix erofs_sys_lsetxattr() returning positive errno
erofs_sys_lsetxattr() returns bare errno (a positive value) on failure, unlike its sibling erofs_sys_lgetxattr() which correctly returns -errno.
Fix by returning -errno, consistent with erofs_sys_lgetxattr().
--- lib/xattr.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
lib/xattr.c +1 -1
@@ -123,7 +123,7 @@ ssize_t erofs_sys_lsetxattr(const char *path, const char *name, errno =ENODATA ;#endif if (ret <0 ) -return errno; +return -errno;return ret; }
Signature · 1 line
2.43.0
Quoted 17 lines · Zhan Xusheng
erofs_sys_lsetxattr()returns bareerrno(a positive value) on failure, unlike its siblingerofs_sys_lgetxattr()which correctly returns-errno.Fix by returning -errno, consistent with
erofs_sys_lgetxattr().Fixes e0d85fc5a282 ("erofs-utils: lib: introduce erofs_sys_lsetxattr()")Signed-off-by Zhan Xusheng <[email protected]>--- lib/xattr.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)lib/xattr.c +0
-0
lib/xattr.c ssize_t erofs_sys_lsetxattr(const char *path, const char *name, · line 129
Quoted 8 lines
lib/xattr.c +1
-1@@ -123,7 +123,7 @@ ssize_t erofs_sys_lsetxattr(const char *path, const char *name, errno =ENODATA ;#endif if (ret <0 ) -return errno; +return -errno;return ret; }
For consistency with erofs_sys_lgetxattr():
- return errno;
+ ret = -errno;
Regards,
Lucas
Hi Lucus,
Quoted 27 lines · Lucas Karpinski
Quoted 17 lines · Zhan Xusheng
erofs_sys_lsetxattr()returns bareerrno(a positive value) on failure, unlike its siblingerofs_sys_lgetxattr()which correctly returns-errno.Fix by returning -errno, consistent with
erofs_sys_lgetxattr().Fixes e0d85fc5a282 ("erofs-utils: lib: introduce erofs_sys_lsetxattr()")Signed-off-by Zhan Xusheng <[email protected]>--- lib/xattr.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)lib/xattr.c +0
-0lib/xattr.c ssize_t erofs_sys_lsetxattr(const char *path, const char *name, · line 129
Quoted 8 lines
lib/xattr.c +1
-1@@ -123,7 +123,7 @@ ssize_t erofs_sys_lsetxattr(const char *path, const char *name, errno =ENODATA ;#endif if (ret <0 ) -return errno; +return -errno;return ret; }For consistency with
erofs_sys_lgetxattr():
Review
Quoted 2 lines
(quoted diff) +1
-1- return errno; + ret = -errno;
Thanks for the suggestion, but it has been applied to -dev branch, so I have to leave it as-is (I tend to avoid rebasing -dev).
Thanks,
Gao Xiang
Quoted 3 lines
Regards,
Lucas
Quoted 5 lines · Gao Xiang
Hi Lucus,
Quoted 3 lines
For consistency with
erofs_sys_lgetxattr():
- return errno;
+ ret = -errno;
Quoted 11 lines
Thanks for the suggestion, but it has been applied to -dev branch, so I have to leave it as-is (I tend to avoid rebasing -dev).
Thanks,
Gao XiangQuoted 3 lines
Regards,
Lucas
No worries, was just a small nit.