From 22f4096ca96acd504ac74e7dfad96f07edb6da51 Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Tue, 31 Aug 2010 21:05:54 +0200 Subject: systemctl: rework exit codes for all utility programs to follow LSB or other standards --- src/modules-load.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'src/modules-load.c') 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); -- cgit v1.2.3-54-g00ecf