openslurpclose_at.c (315B)
1 /* ISC license. */ 2 3 #include <skalibs/djbunix.h> 4 #include <skalibs/unix-transactional.h> 5 6 int openslurpclose_at (int dirfd, char const *fn, stralloc *sa) 7 { 8 int fd = openc_readatb(dirfd, fn) ; 9 if (fd < 0) return 0 ; 10 if (!slurp(sa, fd)) 11 { 12 fd_close(fd) ; 13 return 0 ; 14 } 15 fd_close(fd) ; 16 return 1 ; 17 }