commit 17bc0390ace0e29abd4eb47e5032df81bf3ef2b3
Author: Mattias Andrée <maandree_AT_kth.se>
AuthorDate: Mon May 1 23:22:11 2017 +0200
Commit: Mattias Andrée <maandree_AT_kth.se>
CommitDate: Mon May 1 23:22:11 2017 +0200
Use stdin rather than stdout if - is opened with O_RDWR because <> defaults to stdin
Signed-off-by: Mattias Andrée <maandree_AT_kth.se>
diff --git a/src/util.c b/src/util.c
index a30f0f0..de520de 100644
--- a/src/util.c
+++ b/src/util.c
_AT_@ -244,10 +244,10 @@ xenopen(int status, const char *path, int flags, int mode, ...)
} else if (!strcmp(path, "/dev/stderr")) {
return STDERR_FILENO;
} else if (!strcmp(path, "-")) {
- if ((flags & O_ACCMODE) == O_RDONLY)
- return STDIN_FILENO;
- else
+ if ((flags & O_ACCMODE) == O_WRONLY)
return STDOUT_FILENO;
+ else
+ return STDIN_FILENO;
}
fd = open(path, flags, mode);
if (fd < 0)
Received on Tue May 02 2017 - 00:11:47 CEST
This archive was generated by hypermail 2.3.0
: Tue May 02 2017 - 00:13:06 CEST