diff libpurple/network.c @ 20347:04fe5601fedb

applied changes from 2762c6075c0dc52a96098c5478c5bf68cfd890a3 through 8548e491a5b470d5665cb1cf87a7b0caaa3c87a5
author Luke Schierer <lschiere@pidgin.im>
date Sun, 21 Oct 2007 04:46:33 +0000
parents 6b8bc3309ab7
children 96929e7acb86 35b4f1dc4c8d
line wrap: on
line diff
--- a/libpurple/network.c	Sun Oct 21 04:44:56 2007 +0000
+++ b/libpurple/network.c	Sun Oct 21 04:46:33 2007 +0000
@@ -263,6 +263,7 @@
 purple_network_do_listen(unsigned short port, int socket_type, PurpleNetworkListenCallback cb, gpointer cb_data)
 {
 	int listenfd = -1;
+	int flags;
 	const int on = 1;
 	PurpleNetworkListenData *listen_data;
 	unsigned short actual_port;
@@ -340,7 +341,8 @@
 		close(listenfd);
 		return NULL;
 	}
-	fcntl(listenfd, F_SETFL, O_NONBLOCK);
+	flags = fcntl(listenfd, F_GETFL);
+	fcntl(listenfd, F_SETFL, flags | O_NONBLOCK);
 
 	actual_port = purple_network_get_port_from_fd(listenfd);