aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMattias Andrée <maandree@kth.se>2017-05-01 23:22:11 +0200
committerMattias Andrée <maandree@kth.se>2017-05-01 23:22:11 +0200
commit17bc0390ace0e29abd4eb47e5032df81bf3ef2b3 (patch)
treeac64a44b0230efa28bafd8005305e8a075303260 /src
parentFix blind-skip-pattern (diff)
downloadblind-17bc0390ace0e29abd4eb47e5032df81bf3ef2b3.tar.gz
blind-17bc0390ace0e29abd4eb47e5032df81bf3ef2b3.tar.bz2
blind-17bc0390ace0e29abd4eb47e5032df81bf3ef2b3.tar.xz
Use stdin rather than stdout if - is opened with O_RDWR because <> defaults to stdin
Signed-off-by: Mattias Andrée <maandree@kth.se>
Diffstat (limited to 'src')
-rw-r--r--src/util.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/util.c b/src/util.c
index a30f0f0..de520de 100644
--- a/src/util.c
+++ b/src/util.c
@@ -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)