summaryrefslogtreecommitdiffhomepage
path: root/src/logic/slbt_exec_link.c
diff options
context:
space:
mode:
authormidipix <writeonce@midipix.org>2016-12-14 17:57:04 -0500
committermidipix <writeonce@midipix.org>2016-12-14 19:12:19 -0500
commitec5e56b417a69747befea0d373aeff18016433ad (patch)
tree8655decbb972a2500ed52396a09d1ed34b17cf47 /src/logic/slbt_exec_link.c
parent03e536f958a6668b8ea88a1303d1524ee5e16c99 (diff)
downloadslibtool-ec5e56b417a69747befea0d373aeff18016433ad.tar.bz2
slibtool-ec5e56b417a69747befea0d373aeff18016433ad.tar.xz
link mode: create an archive /dev/null symlink placeholder as needed.
Diffstat (limited to 'src/logic/slbt_exec_link.c')
-rw-r--r--src/logic/slbt_exec_link.c28
1 files changed, 27 insertions, 1 deletions
diff --git a/src/logic/slbt_exec_link.c b/src/logic/slbt_exec_link.c
index 3aa9d2f..8691760 100644
--- a/src/logic/slbt_exec_link.c
+++ b/src/logic/slbt_exec_link.c
@@ -786,6 +786,31 @@ static int slbt_exec_link_create_import_library(
return 0;
}
+static int slbt_exec_link_create_noop_symlink(
+ const struct slbt_driver_ctx * dctx,
+ struct slbt_exec_ctx * ectx,
+ const char * arfilename)
+{
+ struct stat st;
+
+ /* file exists? */
+ if (!(lstat(arfilename,&st)))
+ return 0;
+
+ /* needed? */
+ if (errno == ENOENT) {
+ if (slbt_create_symlink(
+ dctx,ectx,
+ "/dev/null",
+ arfilename,
+ false))
+ return SLBT_NESTED_ERROR(dctx);
+ return 0;
+ }
+
+ return SLBT_SYSTEM_ERROR(dctx);
+}
+
static int slbt_exec_link_create_archive(
const struct slbt_driver_ctx * dctx,
struct slbt_exec_ctx * ectx,
@@ -807,7 +832,8 @@ static int slbt_exec_link_create_archive(
/* -disable-static? */
if (dctx->cctx->drvflags & SLBT_DRIVER_DISABLE_STATIC)
if (dctx->cctx->rpath)
- return 0;
+ return slbt_exec_link_create_noop_symlink(
+ dctx,ectx,arfilename);
/* initial state */
slbt_reset_arguments(ectx);