diff options
author | 2018-06-15 08:45:03 +0000 | |
---|---|---|
committer | 2018-06-15 08:45:03 +0000 | |
commit | 94ed1c32eb6a193ea71762a12e87aee469cc27df (patch) | |
tree | a4a85d36b450b12dc8efe31241a4885cafed2feb | |
parent | Remove the non-BACKWARDS option for GET_THIRD_ADDR. No change to current (diff) | |
download | wireguard-openbsd-94ed1c32eb6a193ea71762a12e87aee469cc27df.tar.xz wireguard-openbsd-94ed1c32eb6a193ea71762a12e87aee469cc27df.zip |
Make sure we always return more than a single '!' in get_shell_command.
This is similar to what vi/ex does and removes the final BACKWARDS flag.
Behaviour requested by and OK tb@
-rw-r--r-- | bin/ed/main.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/bin/ed/main.c b/bin/ed/main.c index bea5d438567..d01a3955eb3 100644 --- a/bin/ed/main.c +++ b/bin/ed/main.c @@ -1,4 +1,4 @@ -/* $OpenBSD: main.c,v 1.64 2018/06/15 08:26:31 martijn Exp $ */ +/* $OpenBSD: main.c,v 1.65 2018/06/15 08:45:03 martijn Exp $ */ /* $NetBSD: main.c,v 1.3 1995/03/21 09:04:44 cgd Exp $ */ /* main.c: This file contains the main control and user-interface routines @@ -983,11 +983,7 @@ get_shell_command(void) REALLOC(buf, n, i + 1, ERR); buf[i++] = *ibufp++; } -#ifdef BACKWARDS - else if (shcmd == NULL || *(shcmd + 1) == '\0') -#else else if (shcmd == NULL) -#endif { seterrmsg("no previous command"); return ERR; @@ -1010,6 +1006,10 @@ get_shell_command(void) s = ibufp++; break; } + if (i == 1) { + seterrmsg("no command"); + return ERR; + } REALLOC(shcmd, shcmdsz, i + 1, ERR); memcpy(shcmd, buf, i); shcmd[shcmdi = i] = '\0'; |