diff options
author | midipix <writeonce@midipix.org> | 2016-05-05 05:54:09 -0400 |
---|---|---|
committer | midipix <writeonce@midipix.org> | 2016-05-05 05:54:09 -0400 |
commit | 4a0a6c6027d1195b4a70fd31c9df768803dfafa2 (patch) | |
tree | 86d224c0ee05aedaccc10cba68b85c272be650ce | |
parent | 855e361ec9d76a81c2348a255c930c27bda7f894 (diff) | |
download | slibtool-4a0a6c6027d1195b4a70fd31c9df768803dfafa2.tar.bz2 slibtool-4a0a6c6027d1195b4a70fd31c9df768803dfafa2.tar.xz |
link mode: executable wrapper: fix generation of condition in wrapper script.
-rw-r--r-- | src/logic/slbt_exec_link.c | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/src/logic/slbt_exec_link.c b/src/logic/slbt_exec_link.c index d48eff8..fe73cf3 100644 --- a/src/logic/slbt_exec_link.c +++ b/src/logic/slbt_exec_link.c @@ -892,11 +892,16 @@ static int slbt_exec_link_create_executable( ectx->argv = depsmeta.altv; ectx->program = depsmeta.altv[0]; + /* executable wrapper symlink */ + if ((size_t)snprintf(wraplnk,sizeof(wraplnk),"%s.exe.wrapper", + dctx->cctx->output) >= sizeof(wraplnk)) + return slbt_exec_link_exit(&depsmeta,-1); + /* executable wrapper: base name */ - if ((base = strrchr(dctx->cctx->output,'/'))) + if ((base = strrchr(wraplnk,'/'))) base++; else - base = wrapper; + base = wraplnk; /* executable wrapper: footer */ fabspath = (exefilename[0] == '/'); @@ -904,7 +909,7 @@ static int slbt_exec_link_create_executable( if (fprintf(ectx->fwrapper, "DL_PATH=\"$DL_PATH$LCOLON$%s\"\n\n" "export %s=$DL_PATH\n\n" - "if [ `basename \"$0\"` = \"%s.exe.wrapper\" ]; then\n" + "if [ `basename \"$0\"` = \"%s\" ]; then\n" "\tprogram=\"$1\"; shift\n" "\texec \"$program\" \"$@\"\n" "fi\n\n" @@ -929,10 +934,6 @@ static int slbt_exec_link_create_executable( fclose(ectx->fwrapper); ectx->fwrapper = 0; - if ((size_t)snprintf(wraplnk,sizeof(wraplnk),"%s.exe.wrapper", - dctx->cctx->output) >= sizeof(wraplnk)) - return slbt_exec_link_exit(&depsmeta,-1); - if (slbt_create_symlink( dctx,ectx, dctx->cctx->output,wraplnk, |