diff options
author | graham.gower <graham.gower@e8e0d7a0-c8d9-11dd-a880-a1081c7ac358> | 2009-11-16 19:17:55 (EST) |
---|---|---|
committer | graham.gower <graham.gower@e8e0d7a0-c8d9-11dd-a880-a1081c7ac358> | 2009-11-16 19:17:55 (EST) |
commit | 603bec779ab8f0751bc48b0394aadd261fafdcde (patch) | |
tree | ae5483583ee4b4185500b68870c25b7e23cd52d6 /libopkg/opkg_download.c | |
parent | cd3404e22aa9baba2c617ce4d4d7f53e3f54853c (diff) |
Use vfork()/execvp() instead of system().
Parts based on a patch by Mike Westerhof for OpenEmbedded.
git-svn-id: http://opkg.googlecode.com/svn/trunk@320 e8e0d7a0-c8d9-11dd-a880-a1081c7ac358
Diffstat (limited to 'libopkg/opkg_download.c')
-rw-r--r-- | libopkg/opkg_download.c | 25 |
1 files changed, 15 insertions, 10 deletions
diff --git a/libopkg/opkg_download.c b/libopkg/opkg_download.c index be3ae2a..953627b 100644 --- a/libopkg/opkg_download.c +++ b/libopkg/opkg_download.c @@ -147,16 +147,21 @@ int opkg_download(opkg_conf_t *conf, const char *src, #else { int res; - char *wgetcmd; - char *wgetopts; - wgetopts = getenv("OPKG_WGETOPTS"); - sprintf_alloc(&wgetcmd, "wget -q %s%s -O \"%s\" \"%s\"", - (conf->http_proxy || conf->ftp_proxy) ? "-Y on " : "", - (wgetopts!=NULL) ? wgetopts : "", - tmp_file_location, src); - opkg_message(conf, OPKG_INFO, "Executing: %s\n", wgetcmd); - res = xsystem(wgetcmd); - free(wgetcmd); + const char *argv[8]; + int i = 0; + + argv[i++] = "wget"; + argv[i++] = "-q"; + if (conf->http_proxy || conf->ftp_proxy) { + argv[i++] = "-Y"; + argv[i++] = "on"; + } + argv[i++] = "-O"; + argv[i++] = tmp_file_location; + argv[i++] = src; + argv[i++] = NULL; + res = xsystem(argv); + if (res) { opkg_message(conf, OPKG_ERROR, "Failed to download %s, error %d\n", src, res); free(tmp_file_location); |