summaryrefslogtreecommitdiff
path: root/cmds-inspect.c
diff options
context:
space:
mode:
authorMisono Tomohiro <misono.tomohiro@jp.fujitsu.com>2018-07-25 17:20:16 +0900
committerDavid Sterba <dsterba@suse.com>2018-08-06 15:06:36 +0200
commit5e2b3eedfcc374e3d8df09ed88b85fc8c087922e (patch)
treeb952dc19e299cf18b7ba9d55724cf2dc9579687f /cmds-inspect.c
parentd99615284a83452c019f5bed05a882f93a4ef19a (diff)
btrfs-progs: inspect logical-resolve: Set correct error value
Reset ret value to zero after snprintf(), which returns the number of written chars. Otherwise non-zero value returns after command success with -P option. Also set return value from __ino_to_path_fd() to reflect the final status for default behavior. Signed-off-by: Misono Tomohiro <misono.tomohiro@jp.fujitsu.com> Signed-off-by: David Sterba <dsterba@suse.com>
Diffstat (limited to 'cmds-inspect.c')
-rw-r--r--cmds-inspect.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/cmds-inspect.c b/cmds-inspect.c
index 2fc50c1a..ac77a5ee 100644
--- a/cmds-inspect.c
+++ b/cmds-inspect.c
@@ -211,6 +211,7 @@ static int cmd_inspect_logical_resolve(int argc, char **argv)
error("path buffer too small: %d bytes", bytes_left);
goto out;
}
+ ret = 0;
for (i = 0; i < inodes->elem_cnt; i += 3) {
u64 inum = inodes->val[i];
@@ -245,7 +246,8 @@ static int cmd_inspect_logical_resolve(int argc, char **argv)
goto out;
}
}
- __ino_to_path_fd(inum, path_fd, verbose, full_path);
+ ret = __ino_to_path_fd(inum, path_fd, verbose,
+ full_path);
if (path_fd != fd)
close_file_or_dir(path_fd, dirs);
} else {