btrfs-progs: prop: don't print full usage on invalid arguments

Let the specific error be the last message printed and don't dump the
whole usage that's not quite helpful in this context.

Signed-off-by: David Sterba <dsterba@suse.com>
This commit is contained in:
David Sterba 2019-03-04 15:05:54 +01:00
parent 2d4b083b7c
commit 5a803bfd27

View File

@ -306,7 +306,7 @@ static int parse_args(int argc, char **argv,
*types = prop_object_dev; *types = prop_object_dev;
} else { } else {
error("invalid object type: %s", type_str); error("invalid object type: %s", type_str);
usage(usage_str); return 1;
} }
} }
@ -321,11 +321,11 @@ static int parse_args(int argc, char **argv,
if (ret < 0) { if (ret < 0) {
errno = -ret; errno = -ret;
error("failed to detect object type: %m"); error("failed to detect object type: %m");
usage(usage_str); return 1;
} }
if (!*types) { if (!*types) {
error("object is not a btrfs object: %s", *object); error("object is not a btrfs object: %s", *object);
usage(usage_str); return 1;
} }
} }