From: Stanislav Brabec Date: Thu, 14 May 2015 15:55:56 +0000 (+0200) Subject: script: Fix mangled EOF and hang on big endian X-Git-Tag: v2.27-rc1~202 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=8fdc064ac3a0b302d8a90f1d80b2feb89ad7f064;p=thirdparty%2Futil-linux.git 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 --- 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(); }