From: Darrick J. Wong Date: Wed, 21 May 2025 22:41:11 +0000 (-0700) Subject: fuse2fs: fix return value handling X-Git-Url: https://git.whamcloud.com/?a=commitdiff_plain;h=f23be676388c3e8afacdf6703755f1b5bda96a47;p=tools%2Fe2fsprogs.git fuse2fs: fix return value handling For the xattr functions, don't obliterate the return value of the file system operation with an error code coming from ext2fs_xattrs_close failing. Granted, it doesn't ever fail (right now!) so this is mostly just preening. Also fix the obsolete op_truncate not to squash error returns. Signed-off-by: Darrick J. Wong Link: https://lore.kernel.org/r/174786677978.1383760.8801097477278077188.stgit@frogsfrogsfrogs Signed-off-by: Theodore Ts'o --- diff --git a/misc/fuse2fs.c b/misc/fuse2fs.c index 9bfddb8..e8417d1 100644 --- a/misc/fuse2fs.c +++ b/misc/fuse2fs.c @@ -2560,7 +2560,7 @@ static int op_getxattr(const char *path, const char *key, char *value, ext2fs_free_mem(&ptr); out2: err = ext2fs_xattrs_close(&h); - if (err) + if (err && !ret) ret = translate_error(fs, ino, err); out: pthread_mutex_unlock(&ff->bfl); @@ -2658,7 +2658,7 @@ static int op_listxattr(const char *path, char *names, size_t len) ret = bufsz; out2: err = ext2fs_xattrs_close(&h); - if (err) + if (err && !ret) ret = translate_error(fs, ino, err); out: pthread_mutex_unlock(&ff->bfl); @@ -2848,7 +2848,7 @@ static int op_removexattr(const char *path, const char *key) ret = update_ctime(fs, ino, NULL); out2: err = ext2fs_xattrs_close(&h); - if (err) + if (err && !ret) ret = translate_error(fs, ino, err); out: pthread_mutex_unlock(&ff->bfl); @@ -3161,7 +3161,7 @@ out2: out: pthread_mutex_unlock(&ff->bfl); - return 0; + return ret; } static int op_fgetattr(const char *path EXT2FS_ATTR((unused)),