From ef2758d5f08747734b560ec586be4ca5cee2c2f4 Mon Sep 17 00:00:00 2001 From: ewt Date: Thu, 2 Apr 1998 17:48:34 +0000 Subject: [PATCH] applied from from Till which fixes a fssizes problem CVS patchset: 2060 CVS date: 1998/04/02 17:48:34 --- lib/fs.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/lib/fs.c b/lib/fs.c index 9a94aa1..77d575d 100644 --- 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) { -- 2.7.4