about summary refs log tree commit homepage
path: root/upgrade.c
diff options
context:
space:
mode:
Diffstat (limited to 'upgrade.c')
-rw-r--r--upgrade.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/upgrade.c b/upgrade.c
index 1311ebe..82a7b28 100644
--- a/upgrade.c
+++ b/upgrade.c
@@ -125,13 +125,14 @@ pid_t mog_upgrade_spawn(void)
 
         assert(dst[bytes - 1] == ',' && "not comma-terminated no listeners?");
         dst[bytes - 1] = '\0'; /* kill the last comma */
+        start.envp[0] = dst;
 
-        pid = fork();
+        pid = mog_fork_for_exec();
         if (pid == 0) {
-                start.envp[0] = dst;
                 mog_svc_upgrade_prepare();
                 execve(execfile, start.argv, start.envp);
-                die_errno("execve %s", execfile);
+                syslog(LOG_ERR, "execve %s failed for upgrade: %m", execfile);
+                _exit(2);
         } else if (pid > 0) {
                 mog_process_register(pid, MOG_PROC_UPGRADE);
                 syslog(LOG_INFO, "upgrade spawned PID:%d", pid);
@@ -143,6 +144,7 @@ out:
         /* find_in_path does not malloc if output == input */
         if (execfile != start.argv[0])
                 mog_free(execfile);
+        start.envp[0] = 0;
         free(dst);
 
         return pid;