From 8fdc064ac3a0b302d8a90f1d80b2feb89ad7f064 Mon Sep 17 00:00:00 2001 From: Stanislav Brabec Date: Thu, 14 May 2015 17:55:56 +0200 Subject: [PATCH] script: Fix mangled EOF and hang on big endian On s390 and other big endian machines, doinput() sends NUL instead of EOF to the tty master. NUL does not even reach the slave, and it is waiting for more data forever. If STDIN is not a tty, the bug caused "^@" being into the log, and since commit 032228c it also causes hang. Signed-off-by: Stanislav Brabec --- term-utils/script.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/term-utils/script.c b/term-utils/script.c index 02ba5965db..e0083f246e 100644 --- a/term-utils/script.c +++ b/term-utils/script.c @@ -377,9 +377,9 @@ doinput(void) { * We usually use this when stdin is not a tty, for example: * echo "ps" | script */ - int c = DEF_EOF; + char c = DEF_EOF; - if (write_all(master, &c, 1)) { + if (write_all(master, &c, sizeof(char))) { warn (_("write failed")); fail(); } -- 2.47.2