summaryrefslogtreecommitdiffhomepage
path: root/src/internal
diff options
context:
space:
mode:
authormidipix <writeonce@midipix.org>2018-08-13 22:43:35 -0400
committermidipix <writeonce@midipix.org>2018-08-13 22:43:35 -0400
commit267766528f3196c8de23613c7896246d745db4e5 (patch)
treee928f4f4217ceaac2b64ac877abfeb267f3e436d /src/internal
parent38b3514b25ab8325a00db59b5e3812f284d1e10a (diff)
downloadslibtool-267766528f3196c8de23613c7896246d745db4e5.tar.bz2
slibtool-267766528f3196c8de23613c7896246d745db4e5.tar.xz
internals: slbt_mkdir() now uses the context's fdcwd.
Diffstat (limited to 'src/internal')
-rw-r--r--src/internal/slibtool_mkdir_impl.h13
1 files changed, 10 insertions, 3 deletions
diff --git a/src/internal/slibtool_mkdir_impl.h b/src/internal/slibtool_mkdir_impl.h
index 5fb8895..7ad9530 100644
--- a/src/internal/slibtool_mkdir_impl.h
+++ b/src/internal/slibtool_mkdir_impl.h
@@ -10,17 +10,24 @@
#include <errno.h>
#include <unistd.h>
+#include "slibtool_driver_impl.h"
+
#ifndef O_DIRECTORY
#define O_DIRECTORY 0
#endif
-static inline int slbt_mkdir(const char * path)
+static inline int slbt_mkdir(
+ const struct slbt_driver_ctx * dctx,
+ const char * path)
{
+ int fdcwd;
int fdlibs;
- if ((fdlibs = open(path,O_DIRECTORY)) >= 0)
+ fdcwd = slbt_driver_fdcwd(dctx);
+
+ if ((fdlibs = openat(fdcwd,path,O_DIRECTORY,0)) >= 0)
close(fdlibs);
- else if ((errno != ENOENT) || mkdir(path,0777))
+ else if ((errno != ENOENT) || mkdirat(fdcwd,path,0777))
if (errno != EEXIST)
return -1;