commit-hurd
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[hurd,commited 3/4] hurd: Fix setxattr return value on replacing


From: Samuel Thibault
Subject: [hurd,commited 3/4] hurd: Fix setxattr return value on replacing
Date: Mon, 10 Jun 2024 22:09:29 +0200

When XATTR_REPLACE is set we shall succeed when the value already
exists, and fail with ENODATA otherwise, instead of the converse.
---
 hurd/xattr.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/hurd/xattr.c b/hurd/xattr.c
index f613d47c83..1a84c90db8 100644
--- a/hurd/xattr.c
+++ b/hurd/xattr.c
@@ -158,10 +158,9 @@ _hurd_xattr_set (io_t port, const char *name, const void 
*value, size_t size,
          if (err)
            return err;
          if (bufsz > 0)
-           {
-             __munmap (buf, bufsz);
-             return ENODATA;
-           }
+           __munmap (buf, bufsz);
+         else
+           return ENODATA;
        }
       return __file_set_translator (port,
                                    FS_TRANS_SET | ((flags & XATTR_CREATE)
-- 
2.43.0




reply via email to

[Prev in Thread] Current Thread [Next in Thread]