summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authormidipix <writeonce@midipix.org>2016-04-19 14:34:37 -0400
committermidipix <writeonce@midipix.org>2016-04-19 14:47:53 -0400
commitd8d0e9e45efe23eb1923a91970f699baad1edf0a (patch)
tree8597fe7751bb3c22872c6d753a42bb0529546bf6
parent77b97bf9eb49d3e7c02ea809352d90c98541304c (diff)
downloadslibtool-d8d0e9e45efe23eb1923a91970f699baad1edf0a.tar.bz2
slibtool-d8d0e9e45efe23eb1923a91970f699baad1edf0a.tar.xz
slbt_copy_file(): restore execution context argument vector at exit.
-rw-r--r--src/helper/slbt_copy_file.c17
1 files changed, 12 insertions, 5 deletions
diff --git a/src/helper/slbt_copy_file.c b/src/helper/slbt_copy_file.c
index fb44dc7..a97c35c 100644
--- a/src/helper/slbt_copy_file.c
+++ b/src/helper/slbt_copy_file.c
@@ -13,7 +13,9 @@ int slbt_copy_file(
char * src,
char * dst)
{
+ char ** oargv;
char * cp[4];
+ int ret;
/* cp argv */
cp[0] = "cp";
@@ -22,17 +24,22 @@ int slbt_copy_file(
cp[3] = 0;
/* alternate argument vector */
+ oargv = ectx->argv;
ectx->argv = cp;
ectx->program = "cp";
/* step output */
- if (!(dctx->cctx->drvflags & SLBT_DRIVER_SILENT))
- if (slbt_output_link(dctx,ectx))
+ if (!(dctx->cctx->drvflags & SLBT_DRIVER_SILENT)) {
+ if (slbt_output_link(dctx,ectx)) {
+ ectx->argv = oargv;
return -1;
+ }
+ }
/* dlltool spawn */
- if ((slbt_spawn(ectx,true) < 0) || ectx->exitcode)
- return -1;
+ ret = ((slbt_spawn(ectx,true) < 0) || ectx->exitcode)
+ ? -1 : 0;
- return 0;
+ ectx->argv = oargv;
+ return ret;
}