summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--coccinelle/exit-0.cocci16
-rw-r--r--src/core/main.c2
-rw-r--r--src/core/shutdown.c2
-rw-r--r--src/coredump/coredumpctl.c2
-rw-r--r--src/libsystemd/sd-bus/test-bus-benchmark.c2
-rw-r--r--src/libsystemd/sd-event/test-event.c2
-rw-r--r--src/quotacheck/quotacheck.c2
-rw-r--r--src/shared/tests.c4
-rw-r--r--src/test/test-capability.c2
-rw-r--r--src/test/test-process-util.c4
-rw-r--r--src/udev/mtd_probe/probe_smartmedia.c2
-rw-r--r--src/udev/scsi_id/scsi_id.c6
12 files changed, 31 insertions, 15 deletions
diff --git a/coccinelle/exit-0.cocci b/coccinelle/exit-0.cocci
new file mode 100644
index 0000000000..8b81600579
--- /dev/null
+++ b/coccinelle/exit-0.cocci
@@ -0,0 +1,16 @@
+@@
+@@
+- exit(0);
++ exit(EXIT_SUCCESS);
+@@
+@@
+- _exit(0);
++ _exit(EXIT_SUCCESS);
+@@
+@@
+- exit(1);
++ exit(EXIT_FAILURE);
+@@
+@@
+- _exit(1);
++ _exit(EXIT_FAILURE);
diff --git a/src/core/main.c b/src/core/main.c
index c717473563..66c2101b24 100644
--- a/src/core/main.c
+++ b/src/core/main.c
@@ -1457,7 +1457,7 @@ static void redirect_telinit(int argc, char *argv[]) {
execv(SYSTEMCTL_BINARY_PATH, argv);
log_error_errno(errno, "Failed to exec " SYSTEMCTL_BINARY_PATH ": %m");
- exit(1);
+ exit(EXIT_FAILURE);
#endif
}
diff --git a/src/core/shutdown.c b/src/core/shutdown.c
index 877f8820dc..efcc264039 100644
--- a/src/core/shutdown.c
+++ b/src/core/shutdown.c
@@ -544,7 +544,7 @@ int main(int argc, char *argv[]) {
* CAP_SYS_BOOT just exit, this will kill our
* container for good. */
log_info("Exiting container.");
- exit(0);
+ exit(EXIT_SUCCESS);
}
r = log_error_errno(errno, "Failed to invoke reboot(): %m");
diff --git a/src/coredump/coredumpctl.c b/src/coredump/coredumpctl.c
index 5013758909..a3f86aa550 100644
--- a/src/coredump/coredumpctl.c
+++ b/src/coredump/coredumpctl.c
@@ -936,7 +936,7 @@ static int run_gdb(sd_journal *j) {
if (r == 0) {
execlp("gdb", "gdb", exe, path, NULL);
log_error_errno(errno, "Failed to invoke gdb: %m");
- _exit(1);
+ _exit(EXIT_FAILURE);
}
r = wait_for_terminate(pid, &st);
diff --git a/src/libsystemd/sd-bus/test-bus-benchmark.c b/src/libsystemd/sd-bus/test-bus-benchmark.c
index a466cddd75..bfd0f39372 100644
--- a/src/libsystemd/sd-bus/test-bus-benchmark.c
+++ b/src/libsystemd/sd-bus/test-bus-benchmark.c
@@ -319,7 +319,7 @@ int main(int argc, char *argv[]) {
break;
}
- _exit(0);
+ _exit(EXIT_SUCCESS);
}
CPU_ZERO(&cpuset);
diff --git a/src/libsystemd/sd-event/test-event.c b/src/libsystemd/sd-event/test-event.c
index 7f32838c6f..87a0c8522d 100644
--- a/src/libsystemd/sd-event/test-event.c
+++ b/src/libsystemd/sd-event/test-event.c
@@ -97,7 +97,7 @@ static int signal_handler(sd_event_source *s, const struct signalfd_siginfo *si,
assert_se(pid >= 0);
if (pid == 0)
- _exit(0);
+ _exit(EXIT_SUCCESS);
assert_se(sd_event_add_child(sd_event_source_get_event(s), &p, pid, WEXITED, child_handler, INT_TO_PTR('f')) >= 0);
assert_se(sd_event_source_set_enabled(p, SD_EVENT_ONESHOT) >= 0);
diff --git a/src/quotacheck/quotacheck.c b/src/quotacheck/quotacheck.c
index b5636e69d4..cd441675dc 100644
--- a/src/quotacheck/quotacheck.c
+++ b/src/quotacheck/quotacheck.c
@@ -116,7 +116,7 @@ int main(int argc, char *argv[]) {
/* Child */
execv(cmdline[0], (char**) cmdline);
- _exit(1); /* Operational error */
+ _exit(EXIT_FAILURE); /* Operational error */
}
r = wait_for_terminate_and_warn("quotacheck", pid, true);
diff --git a/src/shared/tests.c b/src/shared/tests.c
index d78ab7b069..d4781acabf 100644
--- a/src/shared/tests.c
+++ b/src/shared/tests.c
@@ -48,7 +48,7 @@ const char* get_testdata_dir(const char *suffix) {
if (env) {
if (access(env, F_OK) < 0) {
fputs("ERROR: $SYSTEMD_TEST_DATA directory does not exist\n", stderr);
- exit(1);
+ exit(EXIT_FAILURE);
}
strncpy(testdir, env, sizeof(testdir) - 1);
} else {
@@ -65,7 +65,7 @@ const char* get_testdata_dir(const char *suffix) {
/* test this without the suffix, as it may contain a glob */
if (access(testdir, F_OK) < 0) {
fputs("ERROR: Cannot find testdata directory, set $SYSTEMD_TEST_DATA\n", stderr);
- exit(1);
+ exit(EXIT_FAILURE);
}
}
diff --git a/src/test/test-capability.c b/src/test/test-capability.c
index e5db52d404..10cddaf552 100644
--- a/src/test/test-capability.c
+++ b/src/test/test-capability.c
@@ -80,7 +80,7 @@ static void fork_test(void (*test_func)(void)) {
assert_se(pid >= 0);
if (pid == 0) {
test_func();
- exit(0);
+ exit(EXIT_SUCCESS);
} else if (pid > 0) {
int status;
diff --git a/src/test/test-process-util.c b/src/test/test-process-util.c
index 2e262dd15b..c2debf6d15 100644
--- a/src/test/test-process-util.c
+++ b/src/test/test-process-util.c
@@ -354,7 +354,7 @@ static void test_get_process_cmdline_harder(void) {
line = mfree(line);
safe_close(fd);
- _exit(0);
+ _exit(EXIT_SUCCESS);
}
static void test_rename_process_now(const char *p, int ret) {
@@ -463,7 +463,7 @@ static void test_getpid_cached(void) {
c = getpid();
assert_se(a == b && a == c);
- _exit(0);
+ _exit(EXIT_SUCCESS);
}
d = raw_getpid();
diff --git a/src/udev/mtd_probe/probe_smartmedia.c b/src/udev/mtd_probe/probe_smartmedia.c
index eb74fe1eb6..8980ebfb29 100644
--- a/src/udev/mtd_probe/probe_smartmedia.c
+++ b/src/udev/mtd_probe/probe_smartmedia.c
@@ -90,7 +90,7 @@ void probe_smart_media(int mtd_fd, mtd_info_t* info)
printf("MTD_FTL=smartmedia\n");
free(cis_buffer);
- exit(0);
+ exit(EXIT_SUCCESS);
exit:
free(cis_buffer);
return;
diff --git a/src/udev/scsi_id/scsi_id.c b/src/udev/scsi_id/scsi_id.c
index ab4ee7b00b..32c1a8def4 100644
--- a/src/udev/scsi_id/scsi_id.c
+++ b/src/udev/scsi_id/scsi_id.c
@@ -358,7 +358,7 @@ static int set_options(struct udev *udev,
case 'h':
help();
- exit(0);
+ exit(EXIT_SUCCESS);
case 'p':
if (streq(optarg, "0x80"))
@@ -393,7 +393,7 @@ static int set_options(struct udev *udev,
case 'V':
printf("%s\n", PACKAGE_VERSION);
- exit(0);
+ exit(EXIT_SUCCESS);
case 'x':
export = true;
@@ -608,7 +608,7 @@ int main(int argc, char **argv)
* Get command line options (overriding any config file settings).
*/
if (set_options(udev, argc, argv, maj_min_dev) < 0)
- exit(1);
+ exit(EXIT_FAILURE);
if (!dev_specified) {
log_error("No device specified.");