forked from Mirrors/btrfs-progs
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>master
parent
d99615284a
commit
5e2b3eedfc
|
@ -211,6 +211,7 @@ static int cmd_inspect_logical_resolve(int argc, char **argv)
|
||||||
error("path buffer too small: %d bytes", bytes_left);
|
error("path buffer too small: %d bytes", bytes_left);
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
ret = 0;
|
||||||
|
|
||||||
for (i = 0; i < inodes->elem_cnt; i += 3) {
|
for (i = 0; i < inodes->elem_cnt; i += 3) {
|
||||||
u64 inum = inodes->val[i];
|
u64 inum = inodes->val[i];
|
||||||
|
@ -245,7 +246,8 @@ static int cmd_inspect_logical_resolve(int argc, char **argv)
|
||||||
goto out;
|
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)
|
if (path_fd != fd)
|
||||||
close_file_or_dir(path_fd, dirs);
|
close_file_or_dir(path_fd, dirs);
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Reference in New Issue