Fix bcachefs device remove --by-id

That's not how you parse an integer in C...

Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
This commit is contained in:
Kent Overstreet 2021-01-05 15:01:40 -05:00
parent 80846e9c28
commit 41dc1733f1

View File

@ -172,10 +172,15 @@ int cmd_device_remove(int argc, char *argv[])
if (!path)
die("Please supply filesystem to remove device from");
dev_idx = (intptr_t) arg_pop();
if (!dev_idx)
char *dev_str = arg_pop();
if (!dev_str)
die("Please supply device id");
errno = 0;
dev_idx = strtoul(dev_str, NULL, 10);
if (errno)
die("Error parsing device id: %m");
fs = bcache_fs_open(path);
} else {
char *dev = arg_pop();