diff mbox series

[1/3] btrfs-progs: ins: logical-resolve: Set correct error value

Message ID 1447450b84429a439316493340c0c82a605f6539.1532501096.git.misono.tomohiro@jp.fujitsu.com (mailing list archive)
State New, archived
Headers show
Series btrfs-progs: ins: Update for logical-resolve command | expand

Commit Message

Misono Tomohiro July 25, 2018, 8:20 a.m. UTC
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>
---
 cmds-inspect.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

Comments

David Sterba Aug. 3, 2018, 3:07 p.m. UTC | #1
On Wed, Jul 25, 2018 at 05:20:16PM +0900, Misono Tomohiro wrote:
> 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>

Applied, thanks.
--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox series

Patch

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 {