diff options
author | ticktock35 <ticktock35@e8e0d7a0-c8d9-11dd-a880-a1081c7ac358> | 2008-12-15 00:05:24 (EST) |
---|---|---|
committer | ticktock35 <ticktock35@e8e0d7a0-c8d9-11dd-a880-a1081c7ac358> | 2008-12-15 00:05:24 (EST) |
commit | f6c55871edd66dac4339393b0e93a61295684584 (patch) | |
tree | 4f02c02365f89d56405c6d19d38b10707e3f5322 /libopkg | |
parent | 69bae440fd21376d2a717575b1418c962396bd21 (diff) |
opkg: Bug fix for Packages file with a Filename: tag with prepended path.
Patch from Alexandros Kostopoulos <akostop inaccessnetworks com>
git-svn-id: http://opkg.googlecode.com/svn/trunk@66 e8e0d7a0-c8d9-11dd-a880-a1081c7ac358
Diffstat (limited to 'libopkg')
-rw-r--r-- | libopkg/opkg_download.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/libopkg/opkg_download.c b/libopkg/opkg_download.c index 7dc06ef..4e95fae 100644 --- a/libopkg/opkg_download.c +++ b/libopkg/opkg_download.c @@ -178,6 +178,7 @@ int opkg_download_pkg(opkg_conf_t *conf, pkg_t *pkg, const char *dir) int err; char *url; char *pkgid; + char *stripped_filename; if (pkg->src == NULL) { opkg_message(conf,OPKG_ERROR, "ERROR: Package %s (parent %s) is not available from any configured src.\n", @@ -195,7 +196,12 @@ int opkg_download_pkg(opkg_conf_t *conf, pkg_t *pkg, const char *dir) "../../foo.ipk". While this is correct, and exactly what we want to use to construct url above, here we actually need to use just the filename part, without any directory. */ - sprintf_alloc(&pkg->local_filename, "%s/%s", dir, pkg->filename); + + stripped_filename = strrchr(pkg->filename, '/'); + if ( ! stripped_filename ) + stripped_filename = pkg->filename; + + sprintf_alloc(&pkg->local_filename, "%s/%s", dir, stripped_filename); err = opkg_download(conf, url, pkg->local_filename); free(url); |