diff options
author | cinap_lenrek <cinap_lenrek@felloff.net> | 2014-05-24 02:09:52 +0200 |
---|---|---|
committer | cinap_lenrek <cinap_lenrek@felloff.net> | 2014-05-24 02:09:52 +0200 |
commit | 20883bd7de7097936fe87e5fce4d08033ea6c88c (patch) | |
tree | 4b5a25d4ef9b369883c449d71e1a9be09fca21be /sys/src/cmd/cpu.c | |
parent | 2185188f8360ea1952c7339c2702a16f15b12be1 (diff) |
cpu: remove duplicate environment and chdir($home) code (thanks qrstuv)
newns() (called by auth_chuid()) already prepares the
environment variables and puts us in a sane working
directory (as specified by the namespace file).
Diffstat (limited to 'sys/src/cmd/cpu.c')
-rw-r--r-- | sys/src/cmd/cpu.c | 19 |
1 files changed, 5 insertions, 14 deletions
diff --git a/sys/src/cmd/cpu.c b/sys/src/cmd/cpu.c index 53a4bb846..361f568b2 100644 --- a/sys/src/cmd/cpu.c +++ b/sys/src/cmd/cpu.c @@ -335,7 +335,7 @@ old9p(int fd) void remoteside(int old) { - char user[MaxStr], home[MaxStr], buf[MaxStr], xdir[MaxStr], cmd[MaxStr]; + char user[MaxStr], buf[MaxStr], xdir[MaxStr], cmd[MaxStr]; int i, n, fd, badchdir, gotcmd; rfork(RFENVG); @@ -364,11 +364,6 @@ remoteside(int old) if(fd < 0) fatal("srvauth: %r"); - /* Set environment values for the user */ - putenv("user", user); - snprint(home, sizeof(home), "/usr/%s", user); - putenv("home", home); - /* Now collect invoking cpu's current directory or possibly a command */ gotcmd = 0; if(readstr(fd, xdir, sizeof(xdir)) < 0) @@ -380,15 +375,11 @@ remoteside(int old) fatal("dir: %r"); } - /* Establish the new process at the current working directory of the - * gnot */ + /* Establish the new process at the current working directory of the gnot */ badchdir = 0; - if(strcmp(xdir, "NO") == 0) - chdir(home); - else if(chdir(xdir) < 0) { - badchdir = 1; - chdir(home); - } + if(strcmp(xdir, "NO") != 0) + if(chdir(xdir) < 0) + badchdir = 1; /* Start the gnot serving its namespace */ writestr(fd, "FS", "FS", 0); |