From 024315e5234c892f76c816e72ba25d7918ed36b0 Mon Sep 17 00:00:00 2001 From: Alan Cox Date: Thu, 21 May 2015 23:10:45 +0100 Subject: [PATCH] ssh: fix dumb bugs introduced in semi-mechanical translation from stdio --- Applications/util/ssh.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Applications/util/ssh.c b/Applications/util/ssh.c index c7cc4b9c..d4d912af 100644 --- a/Applications/util/ssh.c +++ b/Applications/util/ssh.c @@ -75,9 +75,9 @@ int main(int argc, char *argval[]) for (i = 0; i < MAX_ARGS; i++) arg[i] = NULL; do { write(1, cprompt, 4); - if (read(0, buf, 127) <= 0) + if ((i = read(0, buf, 127)) <= 0) return 0; - buf[strlen(buf) - 1] = '\0'; /* Strip newline from fgets */ + buf[i - 1] = '\0'; /* Strip newline from fgets */ } while (buf[0] == (char) 0); cmd = strtok(buf, " \t"); @@ -183,7 +183,7 @@ int main(int argc, char *argval[]) } write(2, "ssh: ", 5); write(2, cmd, strlen(cmd)); - write(2, "\n", 1); /* Say we can't exec */ + write(2, "?\n", 2); /* Say we can't exec */ exit(1); } /* Parent is in context */ wait(0); /* Parent waits for completion */ -- 2.34.1