X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=blobdiff_plain;f=src%2Fremount-api-vfs.c;h=8bbc021dc43af335a00afed000dc2e3ad0844e31;hb=7fc2a89a7387db1e5daa4892393c9e9536920c25;hp=d51a584f2f7ad24aeac52633bd6f06f36a959452;hpb=449ddb2d23a63ca4c8cd70d13a070fba87c1fb30;p=elogind.git diff --git a/src/remount-api-vfs.c b/src/remount-api-vfs.c index d51a584f2..8bbc021dc 100644 --- a/src/remount-api-vfs.c +++ b/src/remount-api-vfs.c @@ -31,26 +31,29 @@ #include "util.h" #include "set.h" #include "mount-setup.h" +#include "exit-status.h" /* Goes through /etc/fstab and remounts all API file systems, applying * options that are in /etc/fstab that systemd might not have * respected */ int main(int argc, char *argv[]) { - int ret = 1; + int ret = EXIT_FAILURE; FILE *f = NULL; struct mntent* me; Hashmap *pids = NULL; if (argc > 1) { log_error("This program takes no argument."); - return 1; + return EXIT_FAILURE; } log_set_target(LOG_TARGET_SYSLOG_OR_KMSG); log_parse_environment(); log_open(); + umask(0022); + if (!(f = setmntent("/etc/fstab", "r"))) { log_error("Failed to open /etc/fstab: %m"); goto finish; @@ -61,7 +64,7 @@ int main(int argc, char *argv[]) { goto finish; } - ret = 0; + ret = EXIT_SUCCESS; while ((me = getmntent(f))) { pid_t pid; @@ -92,7 +95,7 @@ int main(int argc, char *argv[]) { execv("/bin/mount", (char **) arguments); log_error("Failed to execute /bin/mount: %m"); - _exit(1); + _exit(EXIT_FAILURE); } /* Parent */ @@ -101,7 +104,7 @@ int main(int argc, char *argv[]) { if ((k = hashmap_put(pids, UINT_TO_PTR(pid), s)) < 0) { log_error("Failed to add PID to set: %s", strerror(-k)); - ret = 1; + ret = EXIT_FAILURE; continue; } } @@ -117,7 +120,7 @@ int main(int argc, char *argv[]) { continue; log_error("waitid() failed: %m"); - ret = 1; + ret = EXIT_FAILURE; break; } @@ -128,7 +131,7 @@ int main(int argc, char *argv[]) { else log_error("/bin/mount for %s terminated by signal %s.", s, signal_to_string(si.si_status)); - ret = 1; + ret = EXIT_FAILURE; } free(s);