summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/driver/slbt_driver_ctx.c6
-rw-r--r--src/helper/slbt_archive_import.c4
-rw-r--r--src/logic/slbt_exec_compile.c7
-rw-r--r--src/logic/slbt_exec_link.c7
-rw-r--r--src/logic/slbt_exec_uninstall.c2
5 files changed, 20 insertions, 6 deletions
diff --git a/src/driver/slbt_driver_ctx.c b/src/driver/slbt_driver_ctx.c
index be70ad5..13efa37 100644
--- a/src/driver/slbt_driver_ctx.c
+++ b/src/driver/slbt_driver_ctx.c
@@ -658,6 +658,7 @@ static int slbt_init_host_params(
struct slbt_host_params * host,
struct slbt_host_params * cfgmeta)
{
+ int fdcwd;
int arprobe;
int arfd;
int ecode;
@@ -873,9 +874,12 @@ static int slbt_init_host_params(
cfgmeta->ar = cfgnative;
}
+ /* fdcwd */
+ fdcwd = slbt_driver_fdcwd(dctx);
+
/* clean up */
if (arfd >= 0) {
- unlink(archivename);
+ unlinkat(fdcwd,archivename,0);
close(arfd);
}
}
diff --git a/src/helper/slbt_archive_import.c b/src/helper/slbt_archive_import.c
index 444c48d..071654f 100644
--- a/src/helper/slbt_archive_import.c
+++ b/src/helper/slbt_archive_import.c
@@ -149,10 +149,10 @@ int slbt_archive_import(
0);
if (dst == mridst)
- unlink(dst);
+ unlinkat(fdcwd,dst,0);
if (src == mrisrc)
- unlink(src);
+ unlinkat(fdcwd,src,0);
return (rpid == pid) && (ectx->exitcode == 0)
? 0 : SLBT_CUSTOM_ERROR(dctx,SLBT_ERR_ARCHIVE_IMPORT);
diff --git a/src/logic/slbt_exec_compile.c b/src/logic/slbt_exec_compile.c
index 7a934ab..2a407da 100644
--- a/src/logic/slbt_exec_compile.c
+++ b/src/logic/slbt_exec_compile.c
@@ -21,10 +21,15 @@ static int slbt_exec_compile_remove_file(
struct slbt_exec_ctx * ectx,
const char * target)
{
+ int fdcwd;
+
(void)ectx;
+ /* fdcwd */
+ fdcwd = slbt_driver_fdcwd(dctx);
+
/* remove target (if any) */
- if (!(unlink(target)) || (errno == ENOENT))
+ if (!unlinkat(fdcwd,target,0) || (errno == ENOENT))
return 0;
return SLBT_SYSTEM_ERROR(dctx,0);
diff --git a/src/logic/slbt_exec_link.c b/src/logic/slbt_exec_link.c
index d83935c..0bc474d 100644
--- a/src/logic/slbt_exec_link.c
+++ b/src/logic/slbt_exec_link.c
@@ -867,10 +867,15 @@ static int slbt_exec_link_remove_file(
struct slbt_exec_ctx * ectx,
const char * target)
{
+ int fdcwd;
+
(void)ectx;
+ /* fdcwd */
+ fdcwd = slbt_driver_fdcwd(dctx);
+
/* remove target (if any) */
- if (!(unlink(target)) || (errno == ENOENT))
+ if (!unlinkat(fdcwd,target,0) || (errno == ENOENT))
return 0;
return SLBT_SYSTEM_ERROR(dctx,0);
diff --git a/src/logic/slbt_exec_uninstall.c b/src/logic/slbt_exec_uninstall.c
index b904ef7..7e1d37a 100644
--- a/src/logic/slbt_exec_uninstall.c
+++ b/src/logic/slbt_exec_uninstall.c
@@ -101,7 +101,7 @@ static int slbt_exec_uninstall_fs_entry(
}
/* remove file or symlink entry */
- if (unlink(path))
+ if (unlinkat(fdcwd,path,0))
return SLBT_SYSTEM_ERROR(dctx,path);
/* remove empty containing directory? */