Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/external/bsd/top/dist top(1): chdir to / at init



details:   https://anonhg.NetBSD.org/src/rev/7a1a797869fb
branches:  trunk
changeset: 832939:7a1a797869fb
user:      eadler <eadler%NetBSD.org@localhost>
date:      Sat Jun 02 22:30:19 2018 +0000

description:
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

diffstat:

 external/bsd/top/dist/top.c |  11 ++++++++++-
 1 files changed, 10 insertions(+), 1 deletions(-)

diffs (28 lines):

diff -r 18a805eb0e65 -r 7a1a797869fb external/bsd/top/dist/top.c
--- a/external/bsd/top/dist/top.c       Sat Jun 02 22:25:30 2018 +0000
+++ b/external/bsd/top/dist/top.c       Sat Jun 02 22:30:19 2018 +0000
@@ -119,7 +119,6 @@
 
 {
     screen_end();
-    chdir("/tmp");
     exit(status);
     /* NOTREACHED */
 }
@@ -726,6 +725,16 @@
     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)
     {



Home | Main Index | Thread Index | Old Index