chiark / gitweb /
main: move make_null_stdio() to util.c
[elogind.git] / src / util.c
index d653d6b549beac73ff3884994d2d6334993db2a5..9a82c71dcb249b1e268f8959385fecbc05782f59 100644 (file)
@@ -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)