poldek: poldek/pkg.c, poldek/pm/pset/pset.c - to much slashes

mis mis at pld-linux.org
Sun Jan 27 15:09:58 CET 2008


Author: mis                          Date: Sun Jan 27 14:09:58 2008 GMT
Module: poldek                        Tag: HEAD
---- Log message:
- to much slashes

---- Files affected:
poldek/poldek:
   pkg.c (1.120 -> 1.121) 
poldek/poldek/pm/pset:
   pset.c (1.27 -> 1.28) 

---- Diffs:

================================================================
Index: poldek/poldek/pkg.c
diff -u poldek/poldek/pkg.c:1.120 poldek/poldek/pkg.c:1.121
--- poldek/poldek/pkg.c:1.120	Tue Jan 22 12:40:29 2008
+++ poldek/poldek/pkg.c	Sun Jan 27 15:09:53 2008
@@ -1146,8 +1146,13 @@
 {
     int n = 0;
     
-    if (pkg->pkgdir->path) 
-        n = n_snprintf(buf, size, "%s/", pkg->pkgdir->path);
+    if (pkg->pkgdir->path) {
+        n = n_snprintf(buf, size, "%s", pkg->pkgdir->path);
+        if (n > 0 && buf[n - 1] != '/' && (size_t)n < size - 1) {
+            buf[n++] = '/';
+            buf[n] = '\0';
+        }
+    }
 
     if (pkg_filename(pkg, buf + n, size - n) == NULL)
         buf = NULL;
@@ -1177,27 +1182,20 @@
 char *pkg_localpath(const struct pkg *pkg, char *path, size_t size,
                     const char *cachedir)
 {
+    char buf[1024], namebuf[1024], *fn;
     int n = 0;
-    char namebuf[1024], *fn;
-    char *pkgpath;
-
+    
     n_assert(pkg->pkgdir);
-    pkgpath = pkg->pkgdir->path;
 
+    if (vf_url_type(pkg->pkgdir->path) == VFURL_PATH)
+        return pkg_path(pkg, path, size);
+    
     fn = pkg_filename(pkg, namebuf, sizeof(namebuf));
-    if (vf_url_type(pkgpath) == VFURL_PATH) {
-        n = n_snprintf(path, size, "%s/%s", pkgpath, fn);
-        
-    } else {
-        char buf[1024];
-        //DBGF("pkgpath = %s\n", pkgpath);
-        vf_url_as_dirpath(buf, sizeof(buf), pkgpath);
-        //DBGF("pkgpath_dir = %s\n", buf);
-        
-        n = n_snprintf(path, size, "%s%s%s/%s", cachedir ? cachedir : "",
-                       cachedir ? "/" : "", buf, n_basenam(fn));
-    }
-
+    
+    vf_url_as_dirpath(buf, sizeof(buf), pkg->pkgdir->path);
+    n = n_snprintf(path, size, "%s%s%s/%s", cachedir ? cachedir : "",
+                   cachedir ? "/" : "", buf, n_basenam(fn));
+    
     DBGF("RET %s\n", path);
     if (size - n > 2)
         return path;

================================================================
Index: poldek/poldek/pm/pset/pset.c
diff -u poldek/poldek/pm/pset/pset.c:1.27 poldek/poldek/pm/pset/pset.c:1.28
--- poldek/poldek/pm/pset/pset.c:1.27	Tue Jan 22 10:08:32 2008
+++ poldek/poldek/pm/pset/pset.c	Sun Jan 27 15:09:53 2008
@@ -799,7 +799,7 @@
     if (rc) {
         for (i=0; i < n_array_size(db->paths_added); i++) {
             const char *path = n_array_nth(db->paths_added, i);
-            n_snprintf(dstpath, sizeof(dstpath), "%s/%s", pkgdir->path,
+            n_snprintf(dstpath, sizeof(dstpath), "%s%s", pkgdir->path,
                        n_basenam(path));
             msgn_f(0, "%%cp %s %s\n", path, dstpath);
             msgn_tty(1, "cp %s %s\n", n_basenam(path), dstpath);
================================================================

---- CVS-web:
    http://cvs.pld-linux.org/cgi-bin/cvsweb.cgi/poldek/poldek/pkg.c?r1=1.120&r2=1.121&f=u
    http://cvs.pld-linux.org/cgi-bin/cvsweb.cgi/poldek/poldek/pm/pset/pset.c?r1=1.27&r2=1.28&f=u



More information about the pld-cvs-commit mailing list