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/be06e6269595
branches:  trunk
changeset: 323171:be06e6269595
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 7d7406a25b65 -r be06e6269595 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