summaryrefslogtreecommitdiff
path: root/regress/bin/ksh
diff options
context:
space:
mode:
authoranton <anton@cvs.openbsd.org>2017-06-18 17:49:45 +0000
committeranton <anton@cvs.openbsd.org>2017-06-18 17:49:45 +0000
commit1c1df954e6d1af6e5d7ae193a5de9917605fba8c (patch)
treeee9d6b732d8a72976ddd40f7332e66ce0a3ae9c0 /regress/bin/ksh
parentf7b46abbbf4d67f29569620afdfd1c6b3b6e2ac6 (diff)
Don't write input if ICANON is enabled. Also, write one byte at a time.
Diffstat (limited to 'regress/bin/ksh')
-rw-r--r--regress/bin/ksh/edit/edit.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/regress/bin/ksh/edit/edit.c b/regress/bin/ksh/edit/edit.c
index 0e707af294c..247e0b0ab2e 100644
--- a/regress/bin/ksh/edit/edit.c
+++ b/regress/bin/ksh/edit/edit.c
@@ -34,6 +34,7 @@ int
main(int argc, char *argv[])
{
char in[BUFSIZ], out[BUFSIZ];
+ struct termios tio;
struct pollfd pfd;
struct winsize ws;
pid_t pid;
@@ -100,7 +101,12 @@ main(int argc, char *argv[])
if (nread == 0)
continue;
- n = write(ptyfd, &in[nwrite], nin - nwrite);
+ if (tcgetattr(ptyfd, &tio) == -1)
+ err(1, "tcgetattr");
+ if ((tio.c_lflag & ICANON) == ICANON)
+ continue;
+
+ n = write(ptyfd, &in[nwrite], 1);
if (n == -1)
err(1, "write");
nwrite += n;