summaryrefslogtreecommitdiff
path: root/src/libstddjb/openreadnclose_nb.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/libstddjb/openreadnclose_nb.c')
-rw-r--r--src/libstddjb/openreadnclose_nb.c9
1 files changed, 9 insertions, 0 deletions
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 <skalibs/djbunix.h>
+
+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) ;
+}