skaclient_end.c (575B)
1 /* ISC license. */ 2 3 #include <errno.h> 4 #include <skalibs/djbunix.h> 5 #include <skalibs/skaclient.h> 6 #include <skalibs/unixmessage.h> 7 8 void skaclient_end (skaclient *a) 9 { 10 fd_close(a->syncout.fd) ; 11 fd_close(a->asyncout.fd) ; 12 unixmessage_sender_free(&a->syncout) ; 13 unixmessage_sender_free(&a->asyncout) ; 14 unixmessage_receiver_free(&a->syncin) ; 15 unixmessage_receiver_free(&a->asyncin) ; 16 if (a->pid && a->options & SKACLIENT_OPTION_WAITPID) 17 { 18 int e = errno ; 19 int wstat ; 20 waitpid_nointr(a->pid, &wstat, 0) ; 21 errno = e ; 22 } 23 *a = skaclient_zero ; 24 }