changeset 1423:3e73d02e5f71 HEAD

Don't try to set /dev/null fd nonblocking, all systems don't like that.
author Timo Sirainen <tss@iki.fi>
date Sun, 04 May 2003 19:16:26 +0300
parents b53a185eb4b3
children d8f10cedbc48
files src/master/main.c
diffstat 1 files changed, 10 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/src/master/main.c	Sat May 03 21:46:58 2003 +0300
+++ b/src/master/main.c	Sun May 04 19:16:26 2003 +0300
@@ -264,10 +264,16 @@
 		if (*fd != -1)
 			i_fatal("Protocol %s given more than once", *proto);
 
-		*fd = port == 0 ? dup(null_fd) : net_listen(ip, &port);
-		if (*fd == -1)
-			i_fatal("listen(%d) failed: %m", port);
-		net_set_nonblock(*fd, TRUE);
+		if (port == 0) {
+			*fd = dup(null_fd);
+			if (*fd == -1)
+				i_fatal("dup(null_fd) failed: %m");
+		} else {
+			*fd = net_listen(ip, &port);
+			if (*fd == -1)
+				i_fatal("listen(%d) failed: %m", port);
+			net_set_nonblock(*fd, TRUE);
+		}
 		fd_close_on_exec(*fd, TRUE);
 	}