applied from from Till which fixes a fssizes problem
authorewt <devnull@localhost>
Thu, 2 Apr 1998 17:48:34 +0000 (17:48 +0000)
committerewt <devnull@localhost>
Thu, 2 Apr 1998 17:48:34 +0000 (17:48 +0000)
CVS patchset: 2060
CVS date: 1998/04/02 17:48:34

lib/fs.c

index 9a94aa1..77d575d 100644 (file)
--- a/lib/fs.c
+++ b/lib/fs.c
@@ -231,6 +231,7 @@ int rpmGetFilesystemUsage(char ** fileList, int_32 * fssizes, int numFiles,
     dirName = alloca(maxLen + 1);
     *lastDir = '\0';
 
+    /* cut off last filename */
     for (i = 0; i < numFiles; i++) {
        strcpy(buf, fileList[i]);
        chptr = buf + strlen(buf) - 1;
@@ -251,8 +252,14 @@ int rpmGetFilesystemUsage(char ** fileList, int_32 * fssizes, int numFiles,
                    return 1;
                }
 
+               /* cut off last directory part, because it was not found. */
                while (*chptr != '/') chptr--;
-               *chptr-- = '\0';
+                   *chptr-- = '\0';
+
+               if (chptr == dirName)
+                   dirName[1] = '\0';
+               else
+                   *chptr-- = '\0';
            }
 
            if (lastDev != sb.st_dev) {