summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/internal/slibtool_symlink_impl.c10
-rw-r--r--src/logic/slbt_exec_link.c14
2 files changed, 7 insertions, 17 deletions
diff --git a/src/internal/slibtool_symlink_impl.c b/src/internal/slibtool_symlink_impl.c
index 34661f0..019d3d6 100644
--- a/src/internal/slibtool_symlink_impl.c
+++ b/src/internal/slibtool_symlink_impl.c
@@ -78,7 +78,14 @@ slbt_hidden int slbt_create_symlink(
lnkname) <0)
return SLBT_BUFFER_ERROR(dctx);
+ /* fdcwd */
+ fdcwd = slbt_driver_fdcwd(dctx);
+
/* placeholder? */
+ if (fdevnull)
+ if (unlinkat(fdcwd,lnkname,0) && (errno != ENOENT))
+ return SLBT_SYSTEM_ERROR(dctx,0);
+
if (suffix) {
sprintf(alnkarg,"%s%s",lnkname,suffix);
lnkname = alnkarg;
@@ -115,9 +122,6 @@ slbt_hidden int slbt_create_symlink(
/* restore execution context */
ectx->argv = oargv;
- /* fdcwd */
- fdcwd = slbt_driver_fdcwd(dctx);
-
/* create symlink */
if (symlinkat(atarget,fdcwd,tmplnk))
return SLBT_SYSTEM_ERROR(dctx,tmplnk);
diff --git a/src/logic/slbt_exec_link.c b/src/logic/slbt_exec_link.c
index 1e1e5b2..be9dc20 100644
--- a/src/logic/slbt_exec_link.c
+++ b/src/logic/slbt_exec_link.c
@@ -305,13 +305,6 @@ int slbt_exec_link(const struct slbt_driver_ctx * dctx)
dctx,ectx,
"/dev/null",
ectx->dsofilename,
- SLBT_SYMLINK_LITERAL))
- return SLBT_NESTED_ERROR(dctx);
-
- if (slbt_create_symlink(
- dctx,ectx,
- "/dev/null",
- ectx->dsofilename,
SLBT_SYMLINK_DEVNULL))
return SLBT_NESTED_ERROR(dctx);
}
@@ -322,13 +315,6 @@ int slbt_exec_link(const struct slbt_driver_ctx * dctx)
dctx,ectx,
"/dev/null",
ectx->arfilename,
- SLBT_SYMLINK_LITERAL))
- return SLBT_NESTED_ERROR(dctx);
-
- if (slbt_create_symlink(
- dctx,ectx,
- "/dev/null",
- ectx->arfilename,
SLBT_SYMLINK_DEVNULL))
return SLBT_NESTED_ERROR(dctx);
}