diff options
author | ewt <devnull@localhost> | 1998-01-28 16:49:43 +0000 |
---|---|---|
committer | ewt <devnull@localhost> | 1998-01-28 16:49:43 +0000 |
commit | 2c223345d827d2d77d429faef59d804adf8b33cc (patch) | |
tree | 5c1cd9b3398f88c439dfb81d5583c55510d06125 /lib/package.c | |
parent | b910492639f20d8d37b5839da72d4fca6a04671e (diff) | |
download | rpm-2c223345d827d2d77d429faef59d804adf8b33cc.tar.gz rpm-2c223345d827d2d77d429faef59d804adf8b33cc.tar.bz2 rpm-2c223345d827d2d77d429faef59d804adf8b33cc.zip |
implemented most of generic package relocation
CVS patchset: 1979
CVS date: 1998/01/28 16:49:43
Diffstat (limited to 'lib/package.c')
-rw-r--r-- | lib/package.c | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/lib/package.c b/lib/package.c index 19378bc5d..5ae158316 100644 --- a/lib/package.c +++ b/lib/package.c @@ -34,6 +34,7 @@ static int readPackageHeaders(int fd, struct rpmlead * leadPtr, struct oldrpmlead * oldLead; int_8 arch; int isSource; + char * defaultPrefix; struct stat sb; hdr = hdrPtr ? hdrPtr : &hdrBlock; @@ -43,7 +44,7 @@ static int readPackageHeaders(int fd, struct rpmlead * leadPtr, fstat(fd, &sb); /* if fd points to a socket, pipe, etc, sb.st_size is *always* zero */ - if (S_ISREG(sb.st_mode) && sb.st_size < 4) return 1; + if (S_ISREG(sb.st_mode) && sb.st_size < sizeof(*lead)) return 1; if (readLead(fd, lead)) { return 2; @@ -88,6 +89,19 @@ static int readPackageHeaders(int fd, struct rpmlead * leadPtr, if (sigs) headerFree(*sigs); return 2; } + + /* We switched the way we do relocateable packages. We fix some of + it up here, though the install code still has to be a bit + careful. This fixup makes queries give the new values though, + which is quite handy. */ + if (headerGetEntry(*hdr, RPMTAG_DEFAULTPREFIX, NULL, + (void **) &defaultPrefix, NULL)) { + defaultPrefix = strcpy(alloca(strlen(defaultPrefix) + 1), + defaultPrefix); + stripTrailingSlashes(defaultPrefix); + headerAddEntry(*hdr, RPMTAG_PREFIXES, RPM_STRING_ARRAY_TYPE, + &defaultPrefix, 1); + } } else { rpmError(RPMERR_NEWPACKAGE, _("only packages with major numbers <= 3 " "are supported by this version of RPM")); |