diff mbox series

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

Message ID 20240610200930.616306-4-samuel.thibault@ens-lyon.org
State New
Headers show
Series hurd xattr fixes | expand

Commit Message

Samuel Thibault June 10, 2024, 8:09 p.m. UTC
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 mbox series

Patch

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)