diff options
author | Laurent Bercot <ska-skaware@skarnet.org> | 2017-02-17 22:30:53 +0000 |
---|---|---|
committer | Laurent Bercot <ska-skaware@skarnet.org> | 2017-02-17 22:30:53 +0000 |
commit | fdffefb8032922ce7ffe4c00816072a8ff2148fc (patch) | |
tree | bc7313151a429c45d8bab8ad8b9dd32f4e51335f /src/libstddjb/openreadnclose.c | |
parent | a896ca2a8c617e5e00ffd5fc9e69331ad754e5b3 (diff) | |
download | skalibs-fdffefb8032922ce7ffe4c00816072a8ff2148fc.tar.xz |
More types changes
New disize
Add size_t to the autotypes list
Delete redundant and replace-libc files
dev_t/ino_t pass
Big size_t pass
More things missing, still not operational yet
Diffstat (limited to 'src/libstddjb/openreadnclose.c')
-rw-r--r-- | src/libstddjb/openreadnclose.c | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/src/libstddjb/openreadnclose.c b/src/libstddjb/openreadnclose.c index 40edea9..fcecedc 100644 --- a/src/libstddjb/openreadnclose.c +++ b/src/libstddjb/openreadnclose.c @@ -1,27 +1,28 @@ /* ISC license. */ +#include <sys/types.h> #include <errno.h> #include <skalibs/allreadwrite.h> #include <skalibs/djbunix.h> -static int readnclose (int fd, char *s, unsigned int n) +static ssize_t readnclose (int fd, char *s, size_t n) { - register int r = allread(fd, s, n) ; - register int e = errno ; + ssize_t r = allread(fd, s, n) ; + int e = errno ; fd_close(fd) ; - if ((r > 0) && (r < (int)n)) e = EPIPE ; + if ((r > 0) && (r < (ssize_t)n)) e = EPIPE ; errno = e ; return r ; } -int openreadnclose (char const *file, char *s, unsigned int n) +ssize_t openreadnclose (char const *file, char *s, size_t n) { - register int fd = open_readb(file) ; + int fd = open_readb(file) ; return fd < 0 ? fd : readnclose(fd, s, n) ; } -int openreadnclose_nb (char const *file, char *s, unsigned int n) +ssize_t openreadnclose_nb (char const *file, char *s, size_t n) { - register int fd = open_read(file) ; + int fd = open_read(file) ; return fd < 0 ? fd : readnclose(fd, s, n) ; } |