diff options
Diffstat (limited to 'src/libunixonacid')
-rw-r--r-- | src/libunixonacid/openreadnclose_at.c | 14 |
1 files changed, 2 insertions, 12 deletions
diff --git a/src/libunixonacid/openreadnclose_at.c b/src/libunixonacid/openreadnclose_at.c index 8100997..4858a69 100644 --- a/src/libunixonacid/openreadnclose_at.c +++ b/src/libunixonacid/openreadnclose_at.c @@ -1,20 +1,10 @@ /* ISC license. */ -#include <errno.h> - -#include <skalibs/allreadwrite.h> #include <skalibs/djbunix.h> #include <skalibs/unix-transactional.h> -size_t openreadnclose_at (int dirfd, char const *file, char *s, size_t n) +ssize_t openreadnclose_at (int dirfd, char const *file, char *s, size_t n) { - size_t r ; - int e ; int fd = openc_readatb(dirfd, file) ; - if (fd < 0) return 0 ; - r = allread(fd, s, n) ; - e = errno ; - fd_close(fd) ; - errno = e ; - return r ; + return fd == -1 ? -1 : readnclose(fd, s, n) ; } |