X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=blobdiff_plain;f=src%2Fdetect-virt%2Fdetect-virt.c;h=ff5bee56f91c5f4e7f62920dfdc81d0ad4c413c5;hb=e70bc43cdf75b36e7ad3d29e9a6f8ee1461e7d5e;hp=2f8b0ebbbccca01307a2e43719496f69d7f4d7ab;hpb=eb9da376d76b48585b3b63b4f91903b54f7abd36;p=elogind.git diff --git a/src/detect-virt/detect-virt.c b/src/detect-virt/detect-virt.c index 2f8b0ebbb..ff5bee56f 100644 --- a/src/detect-virt/detect-virt.c +++ b/src/detect-virt/detect-virt.c @@ -36,18 +36,15 @@ static enum { ONLY_CONTAINER } arg_mode = ANY_VIRTUALIZATION; -static int help(void) { - +static void help(void) { printf("%s [OPTIONS...]\n\n" "Detect execution in a virtualized environment.\n\n" " -h --help Show this help\n" " --version Show package version\n" " -c --container Only detect whether we are run in a container\n" " -v --vm Only detect whether we are run in a VM\n" - " -q --quiet Don't output anything, just set return value\n", - program_invocation_short_name); - - return 0; + " -q --quiet Don't output anything, just set return value\n" + , program_invocation_short_name); } static int parse_argv(int argc, char *argv[]) { @@ -70,12 +67,13 @@ static int parse_argv(int argc, char *argv[]) { assert(argc >= 0); assert(argv); - while ((c = getopt_long(argc, argv, "hqcv", options, NULL)) >= 0) { + while ((c = getopt_long(argc, argv, "hqcv", options, NULL)) >= 0) switch (c) { case 'h': - return help(); + help(); + return 0; case ARG_VERSION: puts(PACKAGE_STRING); @@ -100,10 +98,10 @@ static int parse_argv(int argc, char *argv[]) { default: assert_not_reached("Unhandled option"); } - } if (optind < argc) { - help(); + log_error("%s takes no arguments.", + program_invocation_short_name); return -EINVAL; } @@ -129,7 +127,7 @@ int main(int argc, char *argv[]) { switch (arg_mode) { case ANY_VIRTUALIZATION: { - Virtualization v; + int v; v = detect_virtualization(&id); if (v < 0) {