chiark
/
gitweb
/
~ianmdlvl
/
elogind.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
hashmap, set: remove unused functions
[elogind.git]
/
src
/
detect-virt
/
detect-virt.c
diff --git
a/src/detect-virt/detect-virt.c
b/src/detect-virt/detect-virt.c
index bd3ee452c12e67e1696423cc5fd3bc84160de189..ff5bee56f91c5f4e7f62920dfdc81d0ad4c413c5 100644
(file)
--- 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;
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"
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[]) {
}
static int parse_argv(int argc, char *argv[]) {
@@
-62,7
+59,7
@@
static int parse_argv(int argc, char *argv[]) {
{ "container", no_argument, NULL, 'c' },
{ "vm", optional_argument, NULL, 'v' },
{ "quiet", no_argument, NULL, 'q' },
{ "container", no_argument, NULL, 'c' },
{ "vm", optional_argument, NULL, 'v' },
{ "quiet", no_argument, NULL, 'q' },
- {
NULL, 0, NULL, 0
}
+ {}
};
int c;
};
int c;
@@
-70,7
+67,7
@@
static int parse_argv(int argc, char *argv[]) {
assert(argc >= 0);
assert(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) {
switch (c) {
@@
-99,13
+96,12
@@
static int parse_argv(int argc, char *argv[]) {
return -EINVAL;
default:
return -EINVAL;
default:
- log_error("Unknown option code %c", c);
- return -EINVAL;
+ assert_not_reached("Unhandled option");
}
}
- }
if (optind < argc) {
if (optind < argc) {
- help();
+ log_error("%s takes no arguments.",
+ program_invocation_short_name);
return -EINVAL;
}
return -EINVAL;
}
@@
-114,8
+110,8
@@
static int parse_argv(int argc, char *argv[]) {
int main(int argc, char *argv[]) {
const char *id = NULL;
int main(int argc, char *argv[]) {
const char *id = NULL;
- int r;
int retval = EXIT_SUCCESS;
int retval = EXIT_SUCCESS;
+ int r;
/* This is mostly intended to be used for scripts which want
* to detect whether we are being run in a virtualized
/* This is mostly intended to be used for scripts which want
* to detect whether we are being run in a virtualized
@@
-131,7
+127,7
@@
int main(int argc, char *argv[]) {
switch (arg_mode) {
case ANY_VIRTUALIZATION: {
switch (arg_mode) {
case ANY_VIRTUALIZATION: {
-
Virtualization
v;
+
int
v;
v = detect_virtualization(&id);
if (v < 0) {
v = detect_virtualization(&id);
if (v < 0) {