summaryrefslogtreecommitdiff
path: root/src/libunixonacid/skaclient_end.c
blob: 2fd39ab479eb440e2c0aa8fcb6ee531531eae009 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
/* ISC license. */

#include <errno.h>
#include <skalibs/djbunix.h>
#include <skalibs/skaclient.h>
#include <skalibs/unixmessage.h>

void skaclient_end (skaclient *a)
{
  fd_close(a->syncout.fd) ;
  fd_close(a->asyncout.fd) ;
  unixmessage_sender_free(&a->syncout) ;
  unixmessage_sender_free(&a->asyncout) ;
  unixmessage_receiver_free(&a->syncin) ;
  unixmessage_receiver_free(&a->asyncin) ;
  if (a->pid && a->options & SKACLIENT_OPTION_WAITPID)
  {
    int e = errno ;
    int wstat ;
    waitpid_nointr(a->pid, &wstat, 0) ;
    errno = e ;
  }
  *a = skaclient_zero ;
}