summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--package/deps.mak4
-rw-r--r--src/libunixonacid/unixmessage_receiver_free.c1
-rw-r--r--src/libunixonacid/unixmessage_sender_free.c21
-rw-r--r--src/libunixonacid/unixmessage_unput.c1
4 files changed, 13 insertions, 14 deletions
diff --git a/package/deps.mak b/package/deps.mak
index 0200100..932914f 100644
--- a/package/deps.mak
+++ b/package/deps.mak
@@ -752,11 +752,11 @@ src/libunixonacid/unixmessage_handle.o src/libunixonacid/unixmessage_handle.lo:
src/libunixonacid/unixmessage_put.o src/libunixonacid/unixmessage_put.lo: src/libunixonacid/unixmessage_put.c src/include/skalibs/bitarray.h src/include/skalibs/bytestr.h src/include/skalibs/diuint.h src/include/skalibs/error.h src/include/skalibs/genalloc.h src/include/skalibs/siovec.h src/include/skalibs/stralloc.h src/include/skalibs/sysdeps.h src/include/skalibs/unixmessage.h
src/libunixonacid/unixmessage_receive.o src/libunixonacid/unixmessage_receive.lo: src/libunixonacid/unixmessage_receive.c src/include/skalibs/allreadwrite.h src/include/skalibs/cbuffer.h src/include/skalibs/djbunix.h src/include/skalibs/error.h src/include/skalibs/nonposix.h src/include/skalibs/siovec.h src/include/skalibs/stralloc.h src/include/skalibs/sysdeps.h src/include/skalibs/uint16.h src/include/skalibs/uint32.h src/include/skalibs/unixmessage.h
src/libunixonacid/unixmessage_receiver_0.o src/libunixonacid/unixmessage_receiver_0.lo: src/libunixonacid/unixmessage_receiver_0.c src/include/skalibs/unixmessage.h
-src/libunixonacid/unixmessage_receiver_free.o src/libunixonacid/unixmessage_receiver_free.lo: src/libunixonacid/unixmessage_receiver_free.c src/include/skalibs/djbunix.h src/include/skalibs/stralloc.h src/include/skalibs/unixmessage.h
+src/libunixonacid/unixmessage_receiver_free.o src/libunixonacid/unixmessage_receiver_free.lo: src/libunixonacid/unixmessage_receiver_free.c src/include/skalibs/cbuffer.h src/include/skalibs/djbunix.h src/include/skalibs/stralloc.h src/include/skalibs/unixmessage.h
src/libunixonacid/unixmessage_receiver_init.o src/libunixonacid/unixmessage_receiver_init.lo: src/libunixonacid/unixmessage_receiver_init.c src/include/skalibs/cbuffer.h src/include/skalibs/stralloc.h src/include/skalibs/unixmessage.h
src/libunixonacid/unixmessage_sender_1.o src/libunixonacid/unixmessage_sender_1.lo: src/libunixonacid/unixmessage_sender_1.c src/include/skalibs/unixmessage.h
src/libunixonacid/unixmessage_sender_flush.o src/libunixonacid/unixmessage_sender_flush.lo: src/libunixonacid/unixmessage_sender_flush.c src/include/skalibs/allreadwrite.h src/include/skalibs/diuint.h src/include/skalibs/djbunix.h src/include/skalibs/genalloc.h src/include/skalibs/nonposix.h src/include/skalibs/sysdeps.h src/include/skalibs/uint16.h src/include/skalibs/uint32.h src/include/skalibs/unixmessage.h
-src/libunixonacid/unixmessage_sender_free.o src/libunixonacid/unixmessage_sender_free.lo: src/libunixonacid/unixmessage_sender_free.c src/include/skalibs/diuint.h src/include/skalibs/genalloc.h src/include/skalibs/stralloc.h src/include/skalibs/sysdeps.h src/include/skalibs/unixmessage.h
+src/libunixonacid/unixmessage_sender_free.o src/libunixonacid/unixmessage_sender_free.lo: src/libunixonacid/unixmessage_sender_free.c src/include/skalibs/diuint.h src/include/skalibs/djbunix.h src/include/skalibs/genalloc.h src/include/skalibs/stralloc.h src/include/skalibs/sysdeps.h src/include/skalibs/unixmessage.h
src/libunixonacid/unixmessage_sender_getfd.o src/libunixonacid/unixmessage_sender_getfd.lo: src/libunixonacid/unixmessage_sender_getfd.c src/include/skalibs/unixmessage.h
src/libunixonacid/unixmessage_sender_init.o src/libunixonacid/unixmessage_sender_init.lo: src/libunixonacid/unixmessage_sender_init.c src/include/skalibs/genalloc.h src/include/skalibs/stralloc.h src/include/skalibs/unixmessage.h
src/libunixonacid/unixmessage_sender_timed_flush.o src/libunixonacid/unixmessage_sender_timed_flush.lo: src/libunixonacid/unixmessage_sender_timed_flush.c src/include/skalibs/functypes.h src/include/skalibs/tai.h src/include/skalibs/unix-timed.h src/include/skalibs/unixmessage.h
diff --git a/src/libunixonacid/unixmessage_receiver_free.c b/src/libunixonacid/unixmessage_receiver_free.c
index 74654d0..d9d575e 100644
--- a/src/libunixonacid/unixmessage_receiver_free.c
+++ b/src/libunixonacid/unixmessage_receiver_free.c
@@ -1,5 +1,6 @@
/* ISC license. */
+#include <skalibs/cbuffer.h>
#include <skalibs/stralloc.h>
#include <skalibs/djbunix.h>
#include <skalibs/unixmessage.h>
diff --git a/src/libunixonacid/unixmessage_sender_free.c b/src/libunixonacid/unixmessage_sender_free.c
index 797220c..965b1a7 100644
--- a/src/libunixonacid/unixmessage_sender_free.c
+++ b/src/libunixonacid/unixmessage_sender_free.c
@@ -4,24 +4,21 @@
#include <skalibs/diuint.h>
#include <skalibs/stralloc.h>
#include <skalibs/genalloc.h>
+#include <skalibs/djbunix.h>
#include <skalibs/unixmessage.h>
void unixmessage_sender_free (unixmessage_sender_t *b)
{
-#ifdef SKALIBS_HASANCILAUTOCLOSE
+ unsigned int i = genalloc_s(diuint, &b->offsets)[b->head].right ;
+ unsigned int n = genalloc_len(int, &b->fds) ;
+ for (; i < n ; i++)
{
- diuint *offsets = genalloc_s(unsigned int, &b->offsets) ;
- unsigned int n = genalloc_len(unsigned int, &b->offsets) ;
- int *fds = genalloc_s(int, &b->fds) ;
- unsigned int nfds = genalloc_len(int, &b->fds) ;
- for (; b->head < n ; b->head++)
- {
- register unsigned int last = b->head+1 < n ? offsets[b->head+1].right : nfds ;
- register unsigned int i = offsets[b->head].right ;
- for (; i < last ; i++) if (fds[i] >= 0) fd_close(fds[i]) ;
- }
- }
+ register int fd = genalloc_s(int, &b->fds)[i] ;
+ if (fd < 0) fd_close(-(fd+1)) ;
+#ifdef SKALIBS_HASANCILAUTOCLOSE
+ else fd_close(fd) ;
#endif
+ }
genalloc_free(diuint, &b->offsets) ;
genalloc_free(int, &b->fds) ;
stralloc_free(&b->data) ;
diff --git a/src/libunixonacid/unixmessage_unput.c b/src/libunixonacid/unixmessage_unput.c
index 48d46b5..63e94b8 100644
--- a/src/libunixonacid/unixmessage_unput.c
+++ b/src/libunixonacid/unixmessage_unput.c
@@ -19,5 +19,6 @@ int unixmessage_unput_and_maybe_drop (unixmessage_sender_t *b, int drop)
}
b->data.len = start->left ;
genalloc_setlen(int, &b->fds, start->right) ;
+ genalloc_setlen(diuint, &b->offsets, n-1) ;
return 1 ;
}