[git commit] xxd: allow "-" as file name meaning stdin

Denys Vlasenko vda.linux at googlemail.com
Fri Jul 14 14:29:30 UTC 2017


commit: https://git.busybox.net/busybox/commit/?id=90678f0cd72e39806b159a551af85265608219b6
branch: https://git.busybox.net/busybox/commit/?id=refs/heads/master

Signed-off-by: Denys Vlasenko <vda.linux at googlemail.com>
---
 libbb/dump.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/libbb/dump.c b/libbb/dump.c
index 1892772..211a1ed 100644
--- a/libbb/dump.c
+++ b/libbb/dump.c
@@ -339,10 +339,12 @@ static NOINLINE int next(priv_dumper_t *dumper)
 
 		if (fname) {
 			dumper->argv++;
-			if (!freopen(fname, "r", stdin)) {
-				bb_simple_perror_msg(fname);
-				dumper->exitval = 1;
-				continue;
+			if (NOT_LONE_DASH(fname)) {
+				if (!freopen(fname, "r", stdin)) {
+					bb_simple_perror_msg(fname);
+					dumper->exitval = 1;
+					continue;
+				}
 			}
 		} else {
 			if (dumper->next__done)


More information about the busybox-cvs mailing list