diff -Naur lib-old/src/Makefile.in lib-new/src/Makefile.in --- lib-old/src/Makefile.in 2005-05-21 09:36:03.000000000 -0400 +++ lib-new/src/Makefile.in 2005-06-19 12:50:08.000000000 -0400 @@ -220,7 +220,7 @@ lib_LTLIBRARIES = libggz.la include_HEADERS = ggz.h ggz_common.h libggz_la_LIBADD = @LDADD@ $(top_builddir)/src/security/libggzsecurity.la -libggz_la_LDFLAGS = -version-info 3:1:1 +libggz_la_LDFLAGS = -version-info 3:1:0 libggz_la_SOURCES = conf.c \ easysock.c \ ggz.h \ diff -Naur lib-old/src/easysock.c lib-new/src/easysock.c --- lib-old/src/easysock.c 2005-05-14 15:51:48.000000000 -0400 +++ lib-new/src/easysock.c 2005-06-19 19:08:04.000000000 -0400 @@ -64,6 +64,7 @@ #include #include #include +#include #include "ggz.h" @@ -150,6 +151,31 @@ return 0; } +int ggz_accept(const int sock) { + int newsock = accept(sock, NULL, NULL); + if (newsock < 0) { + if (_err_func) + (*_err_func) (strerror(errno), GGZ_IO_CREATE, sock, GGZ_DATA_NONE); + switch (errno) { + case EWOULDBLOCK: + case ECONNABORTED: + case EINTR: + return -1; + default: + return 2; + } + } else { + int flags; + flags = fcntl(newsock, F_GETFL, 0); + if (flags != -1) + flags = fcntl(newsock, F_SETFL, flags & ~O_NONBLOCK); + if (flags == -1 && _err_func) + (*_err_func) (strerror(errno), GGZ_IO_CREATE, sock, GGZ_DATA_NONE); + + return newsock; + } +} + static int es_bind(const char *host, int port) { diff -Naur lib-old/src/ggz.h lib-new/src/ggz.h --- lib-old/src/ggz.h 2005-05-21 06:19:22.000000000 -0400 +++ lib-new/src/ggz.h 2005-06-19 17:24:13.000000000 -0400 @@ -1311,6 +1311,18 @@ GGZ_SOCK_CLIENT /**< Connect to a particular port of a server. */ } GGZSockType; +/** @brief Accept a socket connection. + * + * This function accepts a new socket connection, on an existing socket, + * returning the new socket connection. It ensures that the new socket is + * blocking. + * + * @param sock The existing socket on which to accept a connection. + * @return File descriptor on success, -1 on an error where the call may be + * retried, -2 on other error + */ +int ggz_accept(const int sock); + /** @brief Make a socket connection. * * This function makes a TCP socket connection.