summaryrefslogtreecommitdiff
path: root/sh.c
diff options
context:
space:
mode:
authorRobert Morris <[email protected]>2016-08-08 13:06:38 -0400
committerRobert Morris <[email protected]>2016-08-08 13:06:38 -0400
commit0a4a4230a32696ef7f1f6272ca24520826195b7f (patch)
tree141ab2a59646c6e3799f7d8537eea001ca43a659 /sh.c
parent50edfe1412e5389ce4e3078b223e7b2e72e6ba66 (diff)
downloadxv6-labs-0a4a4230a32696ef7f1f6272ca24520826195b7f.tar.gz
xv6-labs-0a4a4230a32696ef7f1f6272ca24520826195b7f.tar.bz2
xv6-labs-0a4a4230a32696ef7f1f6272ca24520826195b7f.zip
shell nits
fix Regehr complaint
Diffstat (limited to 'sh.c')
-rw-r--r--sh.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/sh.c b/sh.c
index 16e325b..3ac6f5b 100644
--- a/sh.c
+++ b/sh.c
@@ -147,7 +147,7 @@ main(void)
static char buf[100];
int fd;
- // Assumes three file descriptors open.
+ // Ensure that three file descriptors are open.
while((fd = open("console", O_RDWR)) >= 0){
if(fd >= 3){
close(fd);
@@ -158,8 +158,7 @@ main(void)
// Read and run input commands.
while(getcmd(buf, sizeof(buf)) >= 0){
if(buf[0] == 'c' && buf[1] == 'd' && buf[2] == ' '){
- // Clumsy but will have to do for now.
- // Chdir has no effect on the parent if run in the child.
+ // Chdir must be called by the parent, not the child.
buf[strlen(buf)-1] = 0; // chop \n
if(chdir(buf+3) < 0)
printf(2, "cannot cd %s\n", buf+3);