fd_util: added O_NONBLOCK functions

Changed the wrappers for pipe(), socket(), accept().  On WIN32, this
does not work for pipe().
This commit is contained in:
Max Kellermann
2009-11-08 22:11:35 +01:00
parent b043ade456
commit f66edccffd
6 changed files with 55 additions and 26 deletions
+1 -6
View File
@@ -18,7 +18,6 @@
*/
#include "event_pipe.h"
#include "utils.h"
#include "fd_util.h"
#include <stdbool.h>
@@ -85,13 +84,9 @@ void event_pipe_init(void)
GIOChannel *channel;
int ret;
ret = pipe_cloexec(event_pipe);
ret = pipe_cloexec_nonblock(event_pipe);
if (ret < 0)
g_error("Couldn't open pipe: %s", strerror(errno));
#ifndef WIN32
if (set_nonblocking(event_pipe[1]) < 0)
g_error("Couldn't set non-blocking I/O: %s", strerror(errno));
#endif
channel = g_io_channel_unix_new(event_pipe[0]);
event_pipe_source_id = g_io_add_watch(channel, G_IO_IN,