summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/internal/slibtool_libmeta_impl.c5
-rw-r--r--src/internal/slibtool_objmeta_impl.c5
-rw-r--r--src/logic/slbt_exec_install.c8
-rw-r--r--src/logic/slbt_exec_link.c27
4 files changed, 33 insertions, 12 deletions
diff --git a/src/internal/slibtool_libmeta_impl.c b/src/internal/slibtool_libmeta_impl.c
index c1366d9..18984bd 100644
--- a/src/internal/slibtool_libmeta_impl.c
+++ b/src/internal/slibtool_libmeta_impl.c
@@ -9,6 +9,7 @@
#include <string.h>
#include <stdbool.h>
#include <slibtool/slibtool.h>
+#include "slibtool_driver_impl.h"
#include "slibtool_dprintf_impl.h"
#include "slibtool_errinfo_impl.h"
#include "slibtool_metafile_impl.h"
@@ -36,7 +37,7 @@ static int slbt_create_default_library_wrapper(
/* create */
if ((fdout = openat(
- AT_FDCWD,
+ slbt_driver_fdcwd(dctx),
dctx->cctx->output,
O_RDWR|O_CREAT|O_TRUNC,
0644)) < 0)
@@ -148,7 +149,7 @@ static int slbt_create_compatible_library_wrapper(
/* create */
if ((fdout = openat(
- AT_FDCWD,
+ slbt_driver_fdcwd(dctx),
dctx->cctx->output,
O_RDWR|O_CREAT|O_TRUNC,
0644)) < 0)
diff --git a/src/internal/slibtool_objmeta_impl.c b/src/internal/slibtool_objmeta_impl.c
index 86ab420..b38cf75 100644
--- a/src/internal/slibtool_objmeta_impl.c
+++ b/src/internal/slibtool_objmeta_impl.c
@@ -7,6 +7,7 @@
#include <fcntl.h>
#include <stdio.h>
#include <slibtool/slibtool.h>
+#include "slibtool_driver_impl.h"
#include "slibtool_dprintf_impl.h"
#include "slibtool_errinfo_impl.h"
#include "slibtool_metafile_impl.h"
@@ -20,7 +21,7 @@ static int slbt_create_default_object_wrapper(
const struct slbt_source_version * verinfo;
if ((fdout = openat(
- AT_FDCWD,
+ slbt_driver_fdcwd(dctx),
ectx->ltobjname,
O_RDWR|O_CREAT|O_TRUNC,
0644)) < 0)
@@ -61,7 +62,7 @@ static int slbt_create_compatible_object_wrapper(
const struct slbt_source_version * verinfo;
if ((fdout = openat(
- AT_FDCWD,
+ slbt_driver_fdcwd(dctx),
ectx->ltobjname,
O_RDWR|O_CREAT|O_TRUNC,
0644)) < 0)
diff --git a/src/logic/slbt_exec_install.c b/src/logic/slbt_exec_install.c
index 9380e8a..32c1ac6 100644
--- a/src/logic/slbt_exec_install.c
+++ b/src/logic/slbt_exec_install.c
@@ -226,6 +226,7 @@ static int slbt_exec_install_library_wrapper(
struct argv_entry * entry,
char * dstdir)
{
+ int fdcwd;
int fddst;
size_t buflen;
const char * base;
@@ -252,12 +253,15 @@ static int slbt_exec_install_library_wrapper(
entry->arg) >= sizeof(clainame))
return SLBT_BUFFER_ERROR(dctx);
+ /* fdcwd */
+ fdcwd = slbt_driver_fdcwd(dctx);
+
/* fddst (libfoo.la.slibtool.install, build directory) */
- if ((fddst = openat(AT_FDCWD,clainame,O_RDWR|O_CREAT|O_TRUNC,0644)) < 0)
+ if ((fddst = openat(fdcwd,clainame,O_RDWR|O_CREAT|O_TRUNC,0644)) < 0)
return SLBT_SYSTEM_ERROR(dctx);
/* mapinfo (libfoo.la, build directory) */
- if (!(mapinfo = slbt_map_file(AT_FDCWD,entry->arg,SLBT_MAP_INPUT))) {
+ if (!(mapinfo = slbt_map_file(fdcwd,entry->arg,SLBT_MAP_INPUT))) {
close(fddst);
return SLBT_SYSTEM_ERROR(dctx);
}
diff --git a/src/logic/slbt_exec_link.c b/src/logic/slbt_exec_link.c
index af66cd3..0a1b5bd 100644
--- a/src/logic/slbt_exec_link.c
+++ b/src/logic/slbt_exec_link.c
@@ -86,6 +86,7 @@ static int slbt_get_deps_meta(
char * libfilename,
struct slbt_deps_meta * depsmeta)
{
+ int fdcwd;
char * ch;
char * cap;
char * base;
@@ -114,8 +115,11 @@ static int slbt_get_deps_meta(
>= sizeof(depfile))
return SLBT_BUFFER_ERROR(dctx);
+ /* fdcwd */
+ fdcwd = slbt_driver_fdcwd(dctx);
+
/* mapinfo */
- if (!(mapinfo = slbt_map_file(AT_FDCWD,depfile,SLBT_MAP_INPUT)))
+ if (!(mapinfo = slbt_map_file(fdcwd,depfile,SLBT_MAP_INPUT)))
return SLBT_SYSTEM_ERROR(dctx);
/* copied length */
@@ -244,6 +248,7 @@ static int slbt_exec_link_adjust_argument_vector(
{
int fd;
int fdwrap;
+ int fdcwd;
char ** carg;
char ** aarg;
char * ldir;
@@ -279,6 +284,8 @@ static int slbt_exec_link_adjust_argument_vector(
depsmeta,
SLBT_SYSTEM_ERROR(dctx));
+ fdcwd = slbt_driver_fdcwd(dctx);
+
carg = ectx->cargv;
aarg = depsmeta->altv;
darg = depsmeta->args;
@@ -413,7 +420,7 @@ static int slbt_exec_link_adjust_argument_vector(
if (dpath && !stat(dpath,&st)) {
if (!(mapinfo = slbt_map_file(
- AT_FDCWD,dpath,
+ fdcwd,dpath,
SLBT_MAP_INPUT)))
return slbt_exec_link_exit(
depsmeta,
@@ -618,6 +625,7 @@ static int slbt_exec_link_create_dep_file(
{
int ret;
int deps;
+ int fdcwd;
char ** parg;
char * popt;
char * plib;
@@ -635,6 +643,9 @@ static int slbt_exec_link_create_dep_file(
int fnodeps;
struct slbt_map_info * mapinfo;
+ /* fdcwd */
+ fdcwd = slbt_driver_fdcwd(dctx);
+
/* depfile */
slen = snprintf(depfile,sizeof(depfile),
"%s.slibtool.deps",
@@ -644,7 +655,7 @@ static int slbt_exec_link_create_dep_file(
return SLBT_BUFFER_ERROR(dctx);
/* deps */
- if ((deps = openat(AT_FDCWD,depfile,O_RDWR|O_CREAT|O_TRUNC,0644)) < 0)
+ if ((deps = openat(fdcwd,depfile,O_RDWR|O_CREAT|O_TRUNC,0644)) < 0)
return SLBT_SYSTEM_ERROR(dctx);
/* iterate */
@@ -780,7 +791,7 @@ static int slbt_exec_link_create_dep_file(
}
mapinfo = slbt_map_file(
- AT_FDCWD,depfile,
+ fdcwd,depfile,
SLBT_MAP_INPUT);
if (!mapinfo && (errno != ENOENT)) {
@@ -799,7 +810,7 @@ static int slbt_exec_link_create_dep_file(
}
mapinfo = slbt_map_file(
- AT_FDCWD,depfile,
+ fdcwd,depfile,
SLBT_MAP_INPUT);
if (!mapinfo) {
@@ -1261,6 +1272,7 @@ static int slbt_exec_link_create_executable(
struct slbt_exec_ctx * ectx,
const char * exefilename)
{
+ int fdcwd;
int fdwrap;
char ** parg;
char * base;
@@ -1279,6 +1291,9 @@ static int slbt_exec_link_create_executable(
/* placeholders */
slbt_reset_placeholders(ectx);
+ /* fdcwd */
+ fdcwd = slbt_driver_fdcwd(dctx);
+
/* fpic */
fpic = !(dctx->cctx->drvflags & SLBT_DRIVER_ALL_STATIC);
@@ -1307,7 +1322,7 @@ static int slbt_exec_link_create_executable(
>= sizeof(wrapper))
return SLBT_BUFFER_ERROR(dctx);
- if ((fdwrap = openat(AT_FDCWD,wrapper,O_RDWR|O_CREAT|O_TRUNC,0644)) < 0)
+ if ((fdwrap = openat(fdcwd,wrapper,O_RDWR|O_CREAT|O_TRUNC,0644)) < 0)
return SLBT_SYSTEM_ERROR(dctx);
slbt_exec_set_fdwrapper(ectx,fdwrap);