summaryrefslogtreecommitdiff
path: root/packages/ipkg/ipkg-0.99.163/patch-ipkg-localfilename
blob: 41f17fd954c5906b569bfd66c0ab3d60fba9d790 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
--- ipkg-0.99.163.orig/ipkg_download.c	Thu Apr 20 20:18:29 2006
+++ ipkg-0.99.163/ipkg_download.c	Thu Jan 18 05:54:52 2007
@@ -108,6 +108,7 @@
 {
     int err;
     char *url;
+    char *filename;
 
     if (pkg->src == NULL) {
 	ipkg_message(conf,IPKG_ERROR, "ERROR: Package %s (parent %s) is not available from any configured src.\n",
@@ -117,11 +118,16 @@
 
     sprintf_alloc(&url, "%s/%s", pkg->src->value, pkg->filename);
 
-    /* XXX: BUG: The pkg->filename might be something like
+    /* The pkg->filename might be something like
        "../../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);
+    filename = strrchr(pkg->filename, '/');
+    if(NULL == filename)
+        filename = pkg->filename;
+    else
+        filename++;
+    sprintf_alloc(&pkg->local_filename, "%s/%s", dir, filename);
 
     err = ipkg_download(conf, url, pkg->local_filename);
     free(url);