summaryrefslogtreecommitdiff
path: root/src/remount-fs/remount-fs.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/remount-fs/remount-fs.c')
-rw-r--r--src/remount-fs/remount-fs.c13
1 files changed, 4 insertions, 9 deletions
diff --git a/src/remount-fs/remount-fs.c b/src/remount-fs/remount-fs.c
index 2d7cf723f4..1f0397cf6f 100644
--- a/src/remount-fs/remount-fs.c
+++ b/src/remount-fs/remount-fs.c
@@ -87,19 +87,14 @@ int main(int argc, char *argv[]) {
log_debug("Remounting %s", me->mnt_dir);
- pid = fork();
- if (pid < 0) {
- r = log_error_errno(errno, "Failed to fork: %m");
+ r = safe_fork("(remount)", FORK_RESET_SIGNALS|FORK_DEATHSIG, &pid);
+ if (r < 0) {
+ log_error_errno(r, "Failed to fork: %m");
goto finish;
}
-
- if (pid == 0) {
+ if (r == 0) {
/* Child */
- (void) reset_all_signal_handlers();
- (void) reset_signal_mask();
- (void) prctl(PR_SET_PDEATHSIG, SIGTERM);
-
execv(MOUNT_PATH, STRV_MAKE(MOUNT_PATH, me->mnt_dir, "-o", "remount"));
log_error_errno(errno, "Failed to execute " MOUNT_PATH ": %m");