summaryrefslogtreecommitdiff
path: root/src/libunixonacid/unixmessage_sender_flush.c
diff options
context:
space:
mode:
authorLaurent Bercot <ska-skaware@skarnet.org>2016-01-18 23:56:21 +0000
committerLaurent Bercot <ska-skaware@skarnet.org>2016-01-18 23:56:21 +0000
commitc9c7e241a7b68f67e0cc8a7d3874510dced532d6 (patch)
treeb4615c00c3f3c2f7265013b153688496df21f387 /src/libunixonacid/unixmessage_sender_flush.c
parentdb086527035619204569f79672b7a01fc26d8aa4 (diff)
downloadskalibs-c9c7e241a7b68f67e0cc8a7d3874510dced532d6.tar.xz
Add support for advanced closing callbacks to unixmessage_sender_flush.
(Typically, this will be used for refcounting when broadcasting copies of the same fd.)
Diffstat (limited to 'src/libunixonacid/unixmessage_sender_flush.c')
-rw-r--r--src/libunixonacid/unixmessage_sender_flush.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/libunixonacid/unixmessage_sender_flush.c b/src/libunixonacid/unixmessage_sender_flush.c
index 75412fb..6559083 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)
+ if (nfds && b->closecb)
{
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) fd_close(-(fd+1)) ;
+ if (fd < 0) (*b->closecb)(-(fd+1), b->closecbdata) ;
}
}
#endif