socket-util: Move get_null_fd() to daemon.c.
[sliver-openvswitch.git] / lib / socket-util.c
index a13a59c..6bc5d2c 100644 (file)
@@ -925,28 +925,6 @@ error:
     return -error;
 }
 
-/* Returns a readable and writable fd for /dev/null, if successful, otherwise
- * a negative errno value.  The caller must not close the returned fd (because
- * the same fd will be handed out to subsequent callers). */
-int
-get_null_fd(void)
-{
-    static struct ovsthread_once once = OVSTHREAD_ONCE_INITIALIZER;
-    static int null_fd;
-
-    if (ovsthread_once_start(&once)) {
-        null_fd = open("/dev/null", O_RDWR);
-        if (null_fd < 0) {
-            int error = errno;
-            VLOG_ERR("could not open /dev/null: %s", ovs_strerror(error));
-            null_fd = -error;
-        }
-        ovsthread_once_done(&once);
-    }
-
-    return null_fd;
-}
-
 int
 read_fully(int fd, void *p_, size_t size, size_t *bytes_read)
 {