summaryrefslogtreecommitdiff
path: root/src/libunixonacid/opendir_at.c
diff options
context:
space:
mode:
authorLaurent Bercot <ska-skaware@skarnet.org>2021-12-04 08:48:45 +0000
committerLaurent Bercot <ska@appnovation.com>2021-12-04 08:48:45 +0000
commit032b853746aabb8c3b82af674fdc783b511569f2 (patch)
tree79edb0d7148cf2ef34874a20a3f760e464d50025 /src/libunixonacid/opendir_at.c
parent450e114e1e1651c65dfcdbfa3c6f3967163976b3 (diff)
downloadskalibs-032b853746aabb8c3b82af674fdc783b511569f2.tar.xz
Add opendir_at, prepare for 2.11.1.0
Signed-off-by: Laurent Bercot <ska@appnovation.com>
Diffstat (limited to 'src/libunixonacid/opendir_at.c')
-rw-r--r--src/libunixonacid/opendir_at.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/libunixonacid/opendir_at.c b/src/libunixonacid/opendir_at.c
new file mode 100644
index 0000000..bee971f
--- /dev/null
+++ b/src/libunixonacid/opendir_at.c
@@ -0,0 +1,15 @@
+/* ISC license. */
+
+#include <skalibs/direntry.h>
+#include <skalibs/djbunix.h>
+#include <skalibs/unix-transactional.h>
+
+DIR *opendir_at (int dfd, char const *name)
+{
+ DIR *dir ;
+ int fd = open_readatb(dfd, name) ;
+ if (fd < 0) return 0 ;
+ dir = fdopendir(fd) ;
+ if (!dir) fd_close(fd) ;
+ return dir ;
+}