skalibs

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

openwritevnclose_unsafe5.c (400B)


      1 /* ISC license. */
      2 
      3 #include <skalibs/posixplz.h>
      4 #include <skalibs/djbunix.h>
      5 
      6 int openwritevnclose_unsafe5 (char const *fn, struct iovec const *v, unsigned int vlen, devino *devino, unsigned int options)
      7 {
      8   int fd = openc_trunc(fn) ;
      9   if (fd < 0) return 0 ;
     10   if (!writevnclose_unsafe5(fd, v, vlen, devino, options))
     11   {
     12     fd_close(fd) ;
     13     unlink_void(fn) ;
     14     return 0 ;
     15   }
     16   return 1 ;
     17 }