From 66c5d9413ec0bd263eec0e1239b5a28847119134 Mon Sep 17 00:00:00 2001 From: Timothy Stack Date: Tue, 31 Mar 2015 13:00:10 -0700 Subject: [PATCH] fix piping lnav --- src/piper_proc.cc | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/piper_proc.cc b/src/piper_proc.cc index 1e88e243..206f62a0 100644 --- a/src/piper_proc.cc +++ b/src/piper_proc.cc @@ -111,7 +111,9 @@ piper_proc::piper_proc(int pipefd, bool timestamp, const char *filename) int nullfd; nullfd = open("/dev/null", O_RDWR); - dup2(nullfd, STDIN_FILENO); + if (pipefd != STDIN_FILENO) { + dup2(nullfd, STDIN_FILENO); + } dup2(nullfd, STDOUT_FILENO); for (int fd_to_close = 0; fd_to_close < 1024; fd_to_close++) { int flags;