btrfs-progs: inspect: set return value of error case
authorZhao Lei <zhaolei@cn.fujitsu.com>
Mon, 12 Oct 2015 13:22:58 +0000 (21:22 +0800)
committerDavid Sterba <dsterba@suse.com>
Mon, 2 Nov 2015 08:35:01 +0000 (09:35 +0100)
In case of open_file_or_dir() failed, ret is not set to right value,
and the function will return unwanted value(ret of sprintf).

Signed-off-by: Zhao Lei <zhaolei@cn.fujitsu.com>
Signed-off-by: David Sterba <dsterba@suse.com>
cmds-inspect.c

index 879fd43c22a9fcc859df0edd3d1f54843870aec7..a13a170e7fee0ed5f8f0c91a8c4be4dbc31f9822 100644 (file)
@@ -243,6 +243,7 @@ static int cmd_inspect_logical_resolve(int argc, char **argv)
                                if (path_fd < 0) {
                                        fprintf(stderr, "ERROR: can't access "
                                                "'%s'\n", full_path);
+                                       ret = -ENOENT;
                                        goto out;
                                }
                        }