fixed problems with --root

CVS patchset: 180
CVS date: 1996/01/08 21:28:20
This commit is contained in:
root 1996-01-08 21:28:20 +00:00
parent 735ce6fc99
commit db89d2cbfd
2 changed files with 7 additions and 9 deletions

View File

@ -42,8 +42,7 @@ int rpmdbOpen (char * prefix, rpmdb *rpmdbp, int mode, int perms) {
strcpy(filename, prefix);
strcat(filename, "/var/lib/rpm/nameindex.rpm");
db.nameIndex = openDBIndex("/var/lib/rpm/nameindex.rpm",
mode, 0644);
db.nameIndex = openDBIndex(filename, mode, 0644);
if (!db.nameIndex) {
faClose(db.pkgs);
error(RPMERR_DBOPEN, "failed to open %s\n", filename);
@ -52,8 +51,7 @@ int rpmdbOpen (char * prefix, rpmdb *rpmdbp, int mode, int perms) {
strcpy(filename, prefix);
strcat(filename, "/var/lib/rpm/fileindex.rpm");
db.fileIndex = openDBIndex("/var/lib/rpm/fileindex.rpm",
mode, 0644);
db.fileIndex = openDBIndex(filename, mode, 0644);
if (!db.fileIndex) {
faClose(db.pkgs);
closeDBIndex(db.nameIndex);
@ -63,8 +61,7 @@ int rpmdbOpen (char * prefix, rpmdb *rpmdbp, int mode, int perms) {
strcpy(filename, prefix);
strcat(filename, "/var/lib/rpm/groupindex.rpm");
db.groupIndex = openDBIndex("/var/lib/rpm/groupindex.rpm",
mode, 0644);
db.groupIndex = openDBIndex(filename, mode, 0644);
if (!db.groupIndex) {
faClose(db.pkgs);
closeDBIndex(db.nameIndex);

View File

@ -223,14 +223,14 @@ int rpmRemovePackage(char * prefix, rpmdb db, unsigned int offset, int test) {
handleSharedFiles(db, offset, fileList, fileMd5List, fileCount, fileActions);
for (i = 0; i < fileCount; i++) {
if (prefix[0]) {
if (strcmp(prefix, "/")) {
if ((strlen(fileList[i]) + prefixLength + 1) > fnbuffersize) {
fnbuffersize = (strlen(fileList[i]) + prefixLength) * 2;
fnbuffer = alloca(fnbuffersize);
}
strcpy(fnbuffer, "");
strcpy(fnbuffer, prefix);
strcat(fnbuffer, "/");
strcpy(fnbuffer, fileList[i]);
strcat(fnbuffer, fileList[i]);
} else {
fnbuffer = fileList[i];
}
@ -288,6 +288,7 @@ int runScript(char * prefix, Header h, int tag) {
if (strcmp(prefix, "/")) {
message(MESS_DEBUG, "performing chroot(%s)\n", prefix);
chroot(prefix);
chdir("/");
}
if (isdebug)