diff options
author | midipix <writeonce@midipix.org> | 2016-04-16 16:58:22 -0400 |
---|---|---|
committer | midipix <writeonce@midipix.org> | 2016-04-16 16:58:22 -0400 |
commit | 238670b963a2da48ed42a00548a829794baf175a (patch) | |
tree | 16f105c315249f1468bed147a45e418232028f4b /src/logic | |
parent | b762215f29ea3746f6c56d15034b0cc7de418788 (diff) | |
download | slibtool-238670b963a2da48ed42a00548a829794baf175a.tar.bz2 slibtool-238670b963a2da48ed42a00548a829794baf175a.tar.xz |
link mode: executable wrapper: properly handle absolute paths.
Diffstat (limited to 'src/logic')
-rw-r--r-- | src/logic/slbt_exec_link.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/logic/slbt_exec_link.c b/src/logic/slbt_exec_link.c index 3852e6e..501486f 100644 --- a/src/logic/slbt_exec_link.c +++ b/src/logic/slbt_exec_link.c @@ -430,6 +430,7 @@ static int slbt_exec_link_create_executable( char output [PATH_MAX]; char wrapper[PATH_MAX]; char wraplnk[PATH_MAX]; + bool fabspath; /* initial state */ slbt_reset_arguments(ectx); @@ -499,13 +500,16 @@ static int slbt_exec_link_create_executable( ectx->program = ectx->altv[0]; /* executable wrapper: footer */ + fabspath = (exefilename[0] == '/'); + if (fprintf(ectx->fwrapper, "DL_PATH=\"$DL_PATH$LCOLON$%s\"\n\n" "export %s=$DL_PATH\n\n" "exec %s/%s \"$@\"\n", dctx->cctx->settings.ldpathenv, dctx->cctx->settings.ldpathenv, - cwd,exefilename) < 0) + fabspath ? "" : cwd, + fabspath ? &exefilename[1] : exefilename) < 0) return -1; /* step output */ |