(wrong string) ée

From: <git_AT_suckless.org>
Date: Tue, 2 May 2017 00:11:47 +0200 (CEST)

commit 77edf68c1a986fa3f80f5d5c986a736cbb5d24c4
Author: Mattias Andrée <maandree_AT_kth.se>
AuthorDate: Sun Apr 30 14:00:19 2017 +0200
Commit: Mattias Andrée <maandree_AT_kth.se>
CommitDate: Sun Apr 30 14:00:19 2017 +0200

    Do not reopen /dev/std{in,out,err} when specified explicitly
    
    Signed-off-by: Mattias Andrée <maandree_AT_kth.se>

diff --git a/src/util.c b/src/util.c
index b5aac6e..95b46f4 100644
--- a/src/util.c
+++ b/src/util.c
_AT_@ -234,9 +234,16 @@ int
 xenopen(int status, const char *path, int flags, int mode, ...)
 {
         int fd;
- if (!strncmp(path, "/dev/fd/", sizeof("/dev/fd/") - 1))
+ if (!strncmp(path, "/dev/fd/", sizeof("/dev/fd/") - 1)) {
                 if (!toi(path + sizeof("/dev/fd/") - 1, 0, INT_MAX, &fd))
                         return fd;
+ } else if (!strcmp(path, "/dev/stdin")) {
+ return STDIN_FILENO;
+ } else if (!strcmp(path, "/dev/stdout")) {
+ return STDOUT_FILENO;
+ } else if (!strcmp(path, "/dev/stderr")) {
+ return STDERR_FILENO;
+ }
         fd = open(path, flags, mode);
         if (fd < 0)
                 enprintf(status, "open %s:", path);
Received on Tue May 02 2017 - 00:11:47 CEST

This archive was generated by hypermail 2.3.0 : Tue May 02 2017 - 00:12:54 CEST