diff options
| author | Mattias Andrée <maandree@kth.se> | 2017-04-30 14:12:21 +0200 |
|---|---|---|
| committer | Mattias Andrée <maandree@kth.se> | 2017-04-30 14:12:21 +0200 |
| commit | 8c5fcaffb6461ef5706f3dc90653f11eb0065734 (patch) | |
| tree | 2e8d92abf6849f02bdae527efbcf8eb4e6a6df46 /src/util.c | |
| parent | Do not reopen /dev/std{in,out,err} when specified explicitly (diff) | |
| download | blind-8c5fcaffb6461ef5706f3dc90653f11eb0065734.tar.gz blind-8c5fcaffb6461ef5706f3dc90653f11eb0065734.tar.bz2 blind-8c5fcaffb6461ef5706f3dc90653f11eb0065734.tar.xz | |
Use stdin or stdout (depending on access mode) when opening -
Signed-off-by: Mattias Andrée <maandree@kth.se>
Diffstat (limited to '')
| -rw-r--r-- | src/util.c | 5 |
1 files changed, 5 insertions, 0 deletions
@@ -243,6 +243,11 @@ xenopen(int status, const char *path, int flags, int mode, ...) return STDOUT_FILENO; } else if (!strcmp(path, "/dev/stderr")) { return STDERR_FILENO; + } else if (!strcmp(path, "-")) { + if ((flags & O_ACCMODE) == O_RDONLY) + return STDIN_FILENO; + else + return STDOUT_FILENO; } fd = open(path, flags, mode); if (fd < 0) |
