]> git.ipfire.org Git - thirdparty/systemd.git/blobdiff - src/fsck/fsck.c
tree-wide: introduce new safe_fork() helper and port everything over
[thirdparty/systemd.git] / src / fsck / fsck.c
index 0091e388dce2b37046e04ca5faec909580a99753..818d581c3002f278c671a9b1f5246d7db3be60e1 100644 (file)
@@ -392,12 +392,12 @@ int main(int argc, char *argv[]) {
                 }
         }
 
-        pid = fork();
-        if (pid < 0) {
-                r = log_error_errno(errno, "fork(): %m");
+        r = safe_fork("(fsck)", FORK_RESET_SIGNALS|FORK_DEATHSIG, &pid);
+        if (r < 0) {
+                log_error_errno(r, "fork(): %m");
                 goto finish;
         }
-        if (pid == 0) {
+        if (r == 0) {
                 char dash_c[STRLEN("-C") + DECIMAL_STR_MAX(int) + 1];
                 int progress_socket = -1;
                 const char *cmdline[9];
@@ -405,10 +405,6 @@ int main(int argc, char *argv[]) {
 
                 /* Child */
 
-                (void) reset_all_signal_handlers();
-                (void) reset_signal_mask();
-                assert_se(prctl(PR_SET_PDEATHSIG, SIGTERM) == 0);
-
                 /* Close the reading side of the progress pipe */
                 progress_pipe[0] = safe_close(progress_pipe[0]);