From: Darrick J. Wong <djwong@xxxxxxxxxx> 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" <djwong@xxxxxxxxxx> --- misc/fuse2fs.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/misc/fuse2fs.c b/misc/fuse2fs.c index 28b77d367cf705..a630d93f5f48a8 100644 --- a/misc/fuse2fs.c +++ b/misc/fuse2fs.c @@ -2529,7 +2529,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); @@ -2627,7 +2627,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); @@ -2817,7 +2817,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); @@ -3129,7 +3129,7 @@ static int op_ftruncate(const char *path EXT2FS_ATTR((unused)), out: pthread_mutex_unlock(&ff->bfl); - return 0; + return ret; } static int op_fgetattr(const char *path EXT2FS_ATTR((unused)),