aboutsummaryrefslogtreecommitdiffstats
path: root/src/util/eopen.h
diff options
context:
space:
mode:
authorMattias Andrée <maandree@kth.se>2017-01-21 16:34:08 +0100
committerMattias Andrée <maandree@kth.se>2017-01-21 16:40:13 +0100
commit69e3e11a75ed1dabc854406e29bacd5401912874 (patch)
treee7a456eb0b1feb49a0ece87ebb42cbcccd8412b8 /src/util/eopen.h
parentAdd man pages (diff)
downloadblind-69e3e11a75ed1dabc854406e29bacd5401912874.tar.gz
blind-69e3e11a75ed1dabc854406e29bacd5401912874.tar.bz2
blind-69e3e11a75ed1dabc854406e29bacd5401912874.tar.xz
Don't open files from /dev/fd/, just return the fd.
Advantage 1: Less file descriptors opened. Advantage 2: The other end will be alerted when the process closes the file descriptor, and does not have to wait until the process exits. Signed-off-by: Mattias Andrée <maandree@kth.se>
Diffstat (limited to 'src/util/eopen.h')
-rw-r--r--src/util/eopen.h9
1 files changed, 1 insertions, 8 deletions
diff --git a/src/util/eopen.h b/src/util/eopen.h
index 42e8c5d..024381a 100644
--- a/src/util/eopen.h
+++ b/src/util/eopen.h
@@ -4,11 +4,4 @@
#define eopen(...) enopen(1, __VA_ARGS__)
#define enopen(...) xenopen(__VA_ARGS__, 0)
-static inline int
-xenopen(int status, const char *path, int flags, int mode, ...)
-{
- int fd = open(path, flags, mode);
- if (fd < 0)
- enprintf(status, "open %s:", path);
- return fd;
-}
+int xenopen(int status, const char *path, int flags, int mode, ...);