From 6ff596b90a07350eb5896cc63a217e8bb7fec726 Mon Sep 17 00:00:00 2001 From: ewt Date: Mon, 19 Feb 1996 23:34:25 +0000 Subject: [PATCH] 11) removed silly debug message 2) fixed problem with unarchiving files containing shell globbing characters CVS patchset: 332 CVS date: 1996/02/19 23:34:25 --- lib/install.c | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) diff --git a/lib/install.c b/lib/install.c index 448a95a..270a772 100644 --- a/lib/install.c +++ b/lib/install.c @@ -96,6 +96,8 @@ int rpmInstallPackage(char * prefix, rpmdb db, int fd, int flags, int prefixLength = strlen(prefix); char ** prefixedFileList = NULL; struct replacedFile * replacedList = NULL; + char * sptr, * dptr; + int length; rc = pkgReadHeader(fd, &h, &isSource); if (rc) return rc; @@ -250,10 +252,25 @@ int rpmInstallPackage(char * prefix, rpmdb db, int fd, int flags, } if (installFile) { - /* +1 cuts off leading / */ + /* 1) we skip over the leading / + 2) we have to escape globbing characters :-( */ + + length = strlen(fileList[i]); + files[archiveFileCount].fileName = alloca((length * 2) + 1); + dptr = files[archiveFileCount].fileName; + for (sptr = fileList[i] + 1; *sptr; sptr++) { + switch (*sptr) { + case '*': case '[': case ']': case '?': case '\\': + *dptr++ = '\\'; + /*fallthrough*/ + default: + *dptr++ = *sptr; + } + } + *dptr++ = *sptr; - files[archiveFileCount].fileName = fileList[i] + 1; files[archiveFileCount].size = fileSizesList[i]; + archiveFileCount++; } } @@ -982,8 +999,6 @@ static int markReplacedFiles(rpmdb db, struct replacedFile * replList) { secOffset = 0; } else { secHeader = copyHeader(sh); /* so we can modify it */ - printf("old size: %d new size: %d\n", sizeofHeader(sh), - sizeofHeader(secHeader)); freeHeader(sh); } -- 2.7.4