skalibs

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

cdb_init_at.c (335B)


      1 /* ISC license. */
      2 
      3 #include <skalibs/djbunix.h>
      4 #include <skalibs/cdb.h>
      5 #include <skalibs/unix-transactional.h>
      6 
      7 int cdb_init_at (cdb *c, int dfd, char const *file)
      8 {
      9   int fd = open_readat(dfd, file) ;
     10   if (fd < 0) return 0 ;
     11   if (!cdb_init_fromfd(c, fd))
     12   {
     13     fd_close(fd) ;
     14     return 0 ;
     15   }
     16   fd_close(fd) ;
     17   return 1 ;
     18 }