diff options
author | midipix <writeonce@midipix.org> | 2016-04-19 14:34:37 -0400 |
---|---|---|
committer | midipix <writeonce@midipix.org> | 2016-04-19 14:47:53 -0400 |
commit | d8d0e9e45efe23eb1923a91970f699baad1edf0a (patch) | |
tree | 8597fe7751bb3c22872c6d753a42bb0529546bf6 | |
parent | 77b97bf9eb49d3e7c02ea809352d90c98541304c (diff) | |
download | slibtool-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.c | 17 |
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; } |