From 25fe2d50bd75097861db9eac8c8c9f238283ff5f Mon Sep 17 00:00:00 2001 From: Denys Vlasenko Date: Fri, 18 Jun 2021 00:32:29 +0200 Subject: [PATCH] xxd: do not try reading from closed stdin when non-existent file is given Was: xxd: FILE: No such file or directory xxd: FILE: Bad file descriptor function old new delta next 276 278 +2 Signed-off-by: Denys Vlasenko --- libbb/dump.c | 1 + 1 file changed, 1 insertion(+) diff --git a/libbb/dump.c b/libbb/dump.c index 8c2a370d0..9c16f1f94 100644 --- a/libbb/dump.c +++ b/libbb/dump.c @@ -357,6 +357,7 @@ static NOINLINE int next(priv_dumper_t *dumper) if (!freopen(fname, "r", stdin)) { bb_simple_perror_msg(fname); dumper->exitval = 1; + dumper->next__done = 1; continue; } }