From 6129e14bc76488f121c4557eb477886dd9dd2926 Mon Sep 17 00:00:00 2001 From: Laurent Bercot Date: Tue, 2 Feb 2016 07:36:22 +0000 Subject: Revert " Add support for advanced closing callbacks to unixmessage_sender_flush." This reverts commit c9c7e241a7b68f67e0cc8a7d3874510dced532d6. (something is segfaulting, reverting until I find the fix) --- src/libunixonacid/unixmessage_sender_closecb.c | 10 ---------- src/libunixonacid/unixmessage_sender_flush.c | 4 ++-- src/libunixonacid/unixmessage_sender_init.c | 9 ++++++++- src/libunixonacid/unixmessage_sender_init_withclosecb.c | 17 ----------------- 4 files changed, 10 insertions(+), 30 deletions(-) delete mode 100644 src/libunixonacid/unixmessage_sender_closecb.c delete mode 100644 src/libunixonacid/unixmessage_sender_init_withclosecb.c (limited to 'src/libunixonacid') diff --git a/src/libunixonacid/unixmessage_sender_closecb.c b/src/libunixonacid/unixmessage_sender_closecb.c deleted file mode 100644 index 1234ff5..0000000 --- a/src/libunixonacid/unixmessage_sender_closecb.c +++ /dev/null @@ -1,10 +0,0 @@ -/* ISC license. */ - -#include -#include - -void unixmessage_sender_closecb (int fd, void *p) -{ - fd_close(fd) ; - (void)p ; -} diff --git a/src/libunixonacid/unixmessage_sender_flush.c b/src/libunixonacid/unixmessage_sender_flush.c index 6559083..75412fb 100644 --- a/src/libunixonacid/unixmessage_sender_flush.c +++ b/src/libunixonacid/unixmessage_sender_flush.c @@ -97,13 +97,13 @@ int unixmessage_sender_flush (unixmessage_sender_t *b) while (r < 0 && errno == EINTR) ; if (r <= 0) return 0 ; #ifndef SKALIBS_HASANCILAUTOCLOSE - if (nfds && b->closecb) + if (nfds) { register unsigned int i = 0 ; for (; i < nfds ; i++) { register int fd = genalloc_s(int, &b->fds)[offsets[b->head].right + i] ; - if (fd < 0) (*b->closecb)(-(fd+1), b->closecbdata) ; + if (fd < 0) fd_close(-(fd+1)) ; } } #endif diff --git a/src/libunixonacid/unixmessage_sender_init.c b/src/libunixonacid/unixmessage_sender_init.c index 71a8b3b..d986f29 100644 --- a/src/libunixonacid/unixmessage_sender_init.c +++ b/src/libunixonacid/unixmessage_sender_init.c @@ -1,8 +1,15 @@ /* ISC license. */ +#include +#include #include void unixmessage_sender_init (unixmessage_sender_t *b, int fd) { - unixmessage_sender_init_withclosecb(b, fd, &unixmessage_sender_closecb, 0) ; + b->fd = fd ; + b->data = stralloc_zero ; + b->fds = genalloc_zero ; + b->offsets = genalloc_zero ; + b->head = 0 ; + b->shorty = 0 ; } diff --git a/src/libunixonacid/unixmessage_sender_init_withclosecb.c b/src/libunixonacid/unixmessage_sender_init_withclosecb.c deleted file mode 100644 index 32743ec..0000000 --- a/src/libunixonacid/unixmessage_sender_init_withclosecb.c +++ /dev/null @@ -1,17 +0,0 @@ -/* ISC license. */ - -#include -#include -#include - -void unixmessage_sender_init_withclosecb (unixmessage_sender_t *b, int fd, unixmessage_sender_closecb_func_t_ref f, void *p) -{ - b->fd = fd ; - b->data = stralloc_zero ; - b->fds = genalloc_zero ; - b->offsets = genalloc_zero ; - b->head = 0 ; - b->shorty = 0 ; - b->closecb = f ; - b->closecbdata = 0 ; -} -- cgit v1.2.3