aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNathan Reiner <nathan@nathanreiner.xyz>2023-02-09 09:04:34 +0100
committerNathan Reiner <nathan@nathanreiner.xyz>2023-02-09 09:04:34 +0100
commitf298e9e8d66582293fab2a2845ed2808924c1cd4 (patch)
treef530ab23a55e998aba434a88e6130ca3892f119a
parentcc3d9d8d97f40fe81978306cbc4510152fca8ae7 (diff)
fix multi pipe bug
-rw-r--r--smash/exec.c3
-rw-r--r--smash/main.c4
2 files changed, 3 insertions, 4 deletions
diff --git a/smash/exec.c b/smash/exec.c
index 79c8414..0fca393 100644
--- a/smash/exec.c
+++ b/smash/exec.c
@@ -92,7 +92,7 @@ void exec(char *line)
close(pipefd[1][PIPE_IN]);
__execenv((const char **)argv);
- wstdf("command not found: %s\n", argv[0]);
+ wff(STDERR_FD, "command not found: %s\n", argv[0]);
exit(-1);
}
@@ -100,7 +100,6 @@ void exec(char *line)
close(pipefd[0][PIPE_IN]);
close(pipefd[0][PIPE_OUT]);
}
- close(pipefd[1][PIPE_IN]);
pipefd[0][0] = pipefd[1][0];
pipefd[0][1] = pipefd[1][1];
diff --git a/smash/main.c b/smash/main.c
index 4d81f18..48aaed6 100644
--- a/smash/main.c
+++ b/smash/main.c
@@ -12,7 +12,7 @@
#define BUFSIZ 16384
char buf[BUFSIZ] = {0};
-int getline(int fd, char *linebuf)
+int io_getline(int fd, char *linebuf)
{
u64 size = 0;
char *line = buf;
@@ -73,7 +73,7 @@ int main(int argc, char *argv[], char *envp[])
if (fd == STDIN_FD)
wstd(prompt);
- line_length = getline(fd, linebuf);
+ line_length = io_getline(fd, linebuf);
if (line_length == -1) {
break;