zfs_ids_to_path: print correct wrong values

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed-by: Pavel Zakharov <pavel.zakharov@delphix.com>
Reviewed-by: Ryan Moeller <ryan@iXsystems.com>
Signed-off-by: Ahelenia Ziemiańska <nabijaczleweli@nabijaczleweli.xyz>
Closes #11859
This commit is contained in:
наб 2021-04-07 19:06:42 +02:00 committed by Brian Behlendorf
parent ecbf7c6707
commit 4640baab69

View File

@ -63,11 +63,11 @@ main(int argc, char **argv)
uint64_t objset, object; uint64_t objset, object;
if (sscanf(argv[1], "%llu", (u_longlong_t *)&objset) != 1) { if (sscanf(argv[1], "%llu", (u_longlong_t *)&objset) != 1) {
(void) fprintf(stderr, "Invalid objset id: %s\n", argv[2]); (void) fprintf(stderr, "Invalid objset id: %s\n", argv[1]);
usage(2); usage(2);
} }
if (sscanf(argv[2], "%llu", (u_longlong_t *)&object) != 1) { if (sscanf(argv[2], "%llu", (u_longlong_t *)&object) != 1) {
(void) fprintf(stderr, "Invalid object id: %s\n", argv[3]); (void) fprintf(stderr, "Invalid object id: %s\n", argv[2]);
usage(3); usage(3);
} }
if ((g_zfs = libzfs_init()) == NULL) { if ((g_zfs = libzfs_init()) == NULL) {
@ -76,7 +76,7 @@ main(int argc, char **argv)
} }
zpool_handle_t *pool = zpool_open(g_zfs, argv[0]); zpool_handle_t *pool = zpool_open(g_zfs, argv[0]);
if (pool == NULL) { if (pool == NULL) {
fprintf(stderr, "Could not open pool %s\n", argv[1]); fprintf(stderr, "Could not open pool %s\n", argv[0]);
libzfs_fini(g_zfs); libzfs_fini(g_zfs);
return (5); return (5);
} }