Module Name:    src
Committed By:   eadler
Date:           Sat Jun  2 22:30:20 UTC 2018

Modified Files:
        src/external/bsd/top/dist: top.c

Log Message:
top(1): chdir to / at init

This allows us to unmount whatever directory we happen to be in when we
started top(1).

ok phone


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/external/bsd/top/dist/top.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/external/bsd/top/dist/top.c
diff -u src/external/bsd/top/dist/top.c:1.10 src/external/bsd/top/dist/top.c:1.11
--- src/external/bsd/top/dist/top.c:1.10	Thu May 31 09:20:05 2018
+++ src/external/bsd/top/dist/top.c	Sat Jun  2 22:30:19 2018
@@ -119,7 +119,6 @@ quit(int status)
 
 {
     screen_end();
-    chdir("/tmp");
     exit(status);
     /* NOTREACHED */
 }
@@ -726,6 +725,16 @@ main(int argc, char *argv[])
     struct statics statics;
     globalstate *gstate;
 
+    /*
+     * Since top(1) is often long running and
+     * doesn't typically care about where its running from
+     * chdir to the root to allow unmounting of its
+     * original wd. Failure is alright as this is
+     * just a courtesy for users.
+     */
+    chdir("/");
+
+
     /* get our name */
     if (argc > 0)
     {

Reply via email to