From c4e81d83b248aa356849fc6a31920c177b5df999 Mon Sep 17 00:00:00 2001 From: Laurent Bercot Date: Wed, 8 Jun 2022 09:48:11 +0000 Subject: Clean up / homogenize openreadnclose() family Signed-off-by: Laurent Bercot --- src/libstddjb/openreadnclose_nb.c | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 src/libstddjb/openreadnclose_nb.c (limited to 'src/libstddjb/openreadnclose_nb.c') diff --git a/src/libstddjb/openreadnclose_nb.c b/src/libstddjb/openreadnclose_nb.c new file mode 100644 index 0000000..5f6e046 --- /dev/null +++ b/src/libstddjb/openreadnclose_nb.c @@ -0,0 +1,9 @@ +/* ISC license. */ + +#include + +ssize_t openreadnclose_nb (char const *file, char *s, size_t n) +{ + int fd = openc_read(file) ; + return fd == -1 ? fd : readnclose(fd, s, n) ; +} -- cgit v1.2.3