From 633445be1a9be37ae727c044417f5607706cf4ae Mon Sep 17 00:00:00 2001 From: Laurent Bercot Date: Tue, 26 Jun 2018 00:25:28 +0000 Subject: Initial commit --- src/libnsss/nsss_switch_end.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 src/libnsss/nsss_switch_end.c (limited to 'src/libnsss/nsss_switch_end.c') diff --git a/src/libnsss/nsss_switch_end.c b/src/libnsss/nsss_switch_end.c new file mode 100644 index 0000000..3922721 --- /dev/null +++ b/src/libnsss/nsss_switch_end.c @@ -0,0 +1,17 @@ +/* ISC license. */ + +#include +#include +#include + +static inline void nsss_switch_disconnect (nsss_switch_t *a) +{ + fd_close(buffer_fd(&a->b)) ; + a->b.fd = -1 ; +} + +void nsss_switch_end (nsss_switch_t *a, unsigned int what) +{ + a->held &= ~(1U << what) ; + if (!a->held) nsss_switch_disconnect(a) ; +} -- cgit 1.4.1