chiark / gitweb /
units: exclude gettys from isolate requests
[elogind.git] / src / main.c
index a0bcbdf06d0dd38c17e6328af5b0dbabc457dbe8..4e800e7430224f0a0219b1dd88fcea2e49cbc980 100644 (file)
@@ -1343,6 +1343,12 @@ int main(int argc, char *argv[]) {
                 unsetenv("HOME");
                 unsetenv("TERM");
 
+                /* When we are invoked by a shell, these might be set,
+                 * but make little sense to pass on */
+                unsetenv("PWD");
+                unsetenv("SHLVL");
+                unsetenv("_");
+
                 /* All other variables are left as is, so that clients
                  * can still read them via /proc/1/environ */
         }
@@ -1625,6 +1631,11 @@ finish:
 
                 assert(i <= ELEMENTSOF(args));
 
+                /* Close and disarm the watchdog, so that the new
+                 * instance can reinitialize it, but doesn't get
+                 * rebooted while we do that */
+                watchdog_close(true);
+
                 execv(args[0], (char* const*) args);
 
                 log_error("Failed to reexecute: %m");