diff options
author | Lennart Poettering <lennart@poettering.net> | 2010-08-31 21:05:54 +0200 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2010-08-31 21:05:54 +0200 |
commit | 22f4096ca96acd504ac74e7dfad96f07edb6da51 (patch) | |
tree | ebe2bb84f85e0abd8abb508fa91e2c3165bc4ce4 /src/modules-load.c | |
parent | f73e33d9ecdd5f97f31a3efcca254519eef5b7ea (diff) |
systemctl: rework exit codes for all utility programs to follow LSB or other standards
Diffstat (limited to 'src/modules-load.c')
-rw-r--r-- | src/modules-load.c | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/src/modules-load.c b/src/modules-load.c index 44ff02e7b8..bfe5b8a995 100644 --- a/src/modules-load.c +++ b/src/modules-load.c @@ -51,13 +51,13 @@ static int scandir_filter(const struct dirent *d) { int main(int argc, char *argv[]) { struct dirent **de = NULL; - int r = 1, n, i; + int r = EXIT_FAILURE, n, i; char **arguments = NULL; unsigned n_arguments = 0, n_allocated = 0; if (argc > 1) { log_error("This program takes no argument."); - return 1; + return EXIT_FAILURE; } log_set_target(LOG_TARGET_SYSLOG_OR_KMSG); @@ -74,14 +74,14 @@ int main(int argc, char *argv[]) { if ((n = scandir("/etc/modules.d/", &de, scandir_filter, alphasort)) < 0) { if (errno == ENOENT) - r = 0; + r = EXIT_SUCCESS; else log_error("Failed to enumerate /etc/modules.d/ files: %m"); goto finish; } - r = 0; + r = EXIT_SUCCESS; for (i = 0; i < n; i++) { int k; @@ -93,7 +93,7 @@ int main(int argc, char *argv[]) { if (k < 0) { log_error("Failed to allocate file name."); - r = 1; + r = EXIT_FAILURE; continue; } @@ -102,7 +102,7 @@ int main(int argc, char *argv[]) { if (!f) { log_error("Failed to open %s: %m", fn); - r = 1; + r = EXIT_FAILURE; continue; } @@ -130,7 +130,7 @@ int main(int argc, char *argv[]) { if (!(a = realloc(arguments, sizeof(char*) * (m+1)))) { log_error("Failed to increase module array size."); free(t); - r = 1; + r = EXIT_FAILURE; continue; } @@ -142,7 +142,7 @@ int main(int argc, char *argv[]) { } if (ferror(f)) { - r = 1; + r = EXIT_FAILURE; log_error("Failed to read from file: %m"); } @@ -158,7 +158,7 @@ finish: execv("/sbin/modprobe", arguments); log_error("Failed to execute /sbin/modprobe: %m"); - r = 1; + r = EXIT_FAILURE; } strv_free(arguments); |