summaryrefslogtreecommitdiff
path: root/src/util.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2010-10-27 05:45:57 +0200
committerLennart Poettering <lennart@poettering.net>2010-10-27 05:45:57 +0200
commitade509ce73ba1de3bcda8b012961a3045f721df7 (patch)
tree6d814e6d7988f8c871c2cc63e8a56c0d210696dd /src/util.c
parent4690698d4949d8b42e4c3a87944075ceaf685e5a (diff)
main: move make_null_stdio() to util.c
Diffstat (limited to 'src/util.c')
-rw-r--r--src/util.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/util.c b/src/util.c
index d653d6b549..9a82c71dcb 100644
--- a/src/util.c
+++ b/src/util.c
@@ -2605,6 +2605,15 @@ int make_stdio(int fd) {
return 0;
}
+int make_null_stdio(void) {
+ int null_fd;
+
+ if ((null_fd = open("/dev/null", O_RDWR|O_NOCTTY)) < 0)
+ return -errno;
+
+ return make_stdio(null_fd);
+}
+
bool is_clean_exit(int code, int status) {
if (code == CLD_EXITED)