s6

Mirror/fork of https://skarnet.org/software/s6/
git clone https://ccx.te2000.cz/git/s6
Log | Files | Refs | README | LICENSE

ftrig1_free.c (382B)


      1 /* ISC license. */
      2 
      3 #include <skalibs/posixplz.h>
      4 #include <skalibs/stralloc.h>
      5 #include <skalibs/djbunix.h>
      6 #include "ftrig1.h"
      7 
      8 void ftrig1_free (ftrig1_t *p)
      9 {
     10   if (p->name.s)
     11   {
     12     unlink_void(p->name.s) ;
     13     stralloc_free(&p->name) ;
     14   }
     15   if (p->fd >= 0)
     16   {
     17     fd_close(p->fd) ;
     18     p->fd = -1 ;
     19   }
     20   if (p->fdw >= 0)
     21   {
     22     fd_close(p->fdw) ;
     23     p->fdw = -1 ;
     24   }
     25 }