summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjbj <devnull@localhost>2001-02-12 19:02:15 +0000
committerjbj <devnull@localhost>2001-02-12 19:02:15 +0000
commit85a84a6826f982160c31286fb23be771d69eb5ea (patch)
tree3c7b44d9f713c7f61d3f8a0470c2cedd52c15f08
parentbc348ac49cddff43f7aed6d0d17531a8482d0e47 (diff)
downloadlibrpm-tizen-85a84a6826f982160c31286fb23be771d69eb5ea.tar.gz
librpm-tizen-85a84a6826f982160c31286fb23be771d69eb5ea.tar.bz2
librpm-tizen-85a84a6826f982160c31286fb23be771d69eb5ea.zip
Add rpmRC return code type for the usual 0/1/2 codes.
Add RPMRC_BADSIZE to deal with packages changing size after repackaging. CVS patchset: 4550 CVS date: 2001/02/12 19:02:15
-rw-r--r--build/pack.c9
-rw-r--r--lib/package.c54
-rw-r--r--lib/psm.c46
-rw-r--r--lib/query.c35
-rw-r--r--lib/rpmchecksig.c19
-rw-r--r--lib/rpminstall.c27
-rw-r--r--lib/rpmlib.h23
-rw-r--r--lib/signature.c47
-rw-r--r--lib/signature.h4
-rw-r--r--lib/transaction.c9
-rw-r--r--po/rpm.pot200
-rw-r--r--python/rpmmodule.c11
-rw-r--r--tools/rpmsort.c3
13 files changed, 276 insertions, 211 deletions
diff --git a/build/pack.c b/build/pack.c
index 84c9f8fca..1a3672ed7 100644
--- a/build/pack.c
+++ b/build/pack.c
@@ -236,7 +236,7 @@ int readRPM(const char *fileName, Spec *specp, struct rpmlead *lead, Header *sig
{
FD_t fdi;
Spec spec;
- int rc;
+ rpmRC rc;
if (fileName != NULL) {
fdi = Fopen(fileName, "r.ufdio");
@@ -271,12 +271,15 @@ int readRPM(const char *fileName, Spec *specp, struct rpmlead *lead, Header *sig
/* Read the rpm lead and header */
rc = rpmReadPackageInfo(fdi, sigs, &spec->packages->header);
switch (rc) {
- case 1:
+ case RPMRC_BADMAGIC:
rpmError(RPMERR_BADMAGIC, _("readRPM: %s is not an RPM package\n"),
fileName);
return RPMERR_BADMAGIC;
- case 0:
+ case RPMRC_OK:
break;
+ case RPMRC_FAIL:
+ case RPMRC_BADSIZE:
+ case RPMRC_SHORTREAD:
default:
rpmError(RPMERR_BADMAGIC, _("readRPM: reading header from %s\n"),
fileName);
diff --git a/lib/package.c b/lib/package.c
index e4bc62fd2..eb4428128 100644
--- a/lib/package.c
+++ b/lib/package.c
@@ -83,9 +83,9 @@ Header headerRegenSigHeader(const Header h)
* @param leadPtr address of lead (or NULL)
* @param sigs address of signatures (or NULL)
* @param hdrPtr address of header (or NULL)
- * @return 0 on success, 1 on bad magic, 2 on error
+ * @return rpmRC return code
*/
-static int readPackageHeaders(FD_t fd, /*@out@*/ struct rpmlead * leadPtr,
+static rpmRC readPackageHeaders(FD_t fd, /*@out@*/ struct rpmlead * leadPtr,
/*@out@*/ Header * sigs, /*@out@*/ Header *hdrPtr)
/*@modifies fd, *leadPtr, *sigs, *hdrPtr @*/
{
@@ -96,6 +96,7 @@ static int readPackageHeaders(FD_t fd, /*@out@*/ struct rpmlead * leadPtr,
char * defaultPrefix;
struct stat sb;
int_32 true = 1;
+ rpmRC rc;
hdr = hdrPtr ? hdrPtr : &hdrBlock;
lead = leadPtr ? leadPtr : &leadBlock;
@@ -105,35 +106,38 @@ static int readPackageHeaders(FD_t fd, /*@out@*/ struct rpmlead * leadPtr,
if (S_ISREG(sb.st_mode) && sb.st_size < sizeof(*lead)) return 1;
if (readLead(fd, lead))
- return 2;
+ return RPMRC_FAIL;
if (lead->magic[0] != RPMLEAD_MAGIC0 || lead->magic[1] != RPMLEAD_MAGIC1 ||
lead->magic[2] != RPMLEAD_MAGIC2 || lead->magic[3] != RPMLEAD_MAGIC3) {
- return 1;
+ return RPMRC_BADMAGIC;
}
switch (lead->major) {
case 1:
rpmError(RPMERR_NEWPACKAGE,
_("packaging version 1 is not supported by this version of RPM\n"));
- return 2;
+ return RPMRC_FAIL;
/*@notreached@*/ break;
case 2:
case 3:
case 4:
- if (rpmReadSignature(fd, sigs, lead->signature_type))
- return 2;
+ rc = rpmReadSignature(fd, sigs, lead->signature_type);
+ if (rc == RPMRC_FAIL)
+ return rc;
*hdr = headerRead(fd, (lead->major >= 3)
? HEADER_MAGIC_YES : HEADER_MAGIC_NO);
if (*hdr == NULL) {
if (sigs != NULL)
headerFree(*sigs);
- return 2;
+ return RPMRC_FAIL;
}
- /* We don't use these entries (and rpm >= 2 never have) and they are
- pretty misleading. Let's just get rid of them so they don't confuse
- anyone. */
+ /*
+ * We don't use these entries (and rpm >= 2 never has) and they are
+ * pretty misleading. Let's just get rid of them so they don't confuse
+ * anyone.
+ */
if (headerIsEntry(*hdr, RPMTAG_FILEUSERNAME))
headerRemoveEntry(*hdr, RPMTAG_FILEUIDS);
if (headerIsEntry(*hdr, RPMTAG_FILEGROUPNAME))
@@ -151,10 +155,12 @@ static int readPackageHeaders(FD_t fd, /*@out@*/ struct rpmlead * leadPtr,
&defaultPrefix, 1);
}
- /* The file list was moved to a more compressed format which not
- only saves memory (nice), but gives fingerprinting a nice, fat
- speed boost (very nice). Go ahead and convert old headers to
- the new style (this is a noop for new headers) */
+ /*
+ * The file list was moved to a more compressed format which not
+ * only saves memory (nice), but gives fingerprinting a nice, fat
+ * speed boost (very nice). Go ahead and convert old headers to
+ * the new style (this is a noop for new headers).
+ */
if (lead->major < 4)
compressFilelist(*hdr);
@@ -164,7 +170,7 @@ static int readPackageHeaders(FD_t fd, /*@out@*/ struct rpmlead * leadPtr,
headerAddEntry(*hdr, RPMTAG_SOURCEPACKAGE, RPM_INT32_TYPE,
&true, 1);
} else if (lead->major < 4) {
- /* Retrofit "Provide: name = EVR" for binary packages. */
+ /* Retrofit "Provide: name = EVR" for binary packages. */
providePackageNVR(*hdr);
}
break;
@@ -172,34 +178,34 @@ static int readPackageHeaders(FD_t fd, /*@out@*/ struct rpmlead * leadPtr,
default:
rpmError(RPMERR_NEWPACKAGE, _("only packaging with major numbers <= 4 "
"is supported by this version of RPM\n"));
- return 2;
+ return RPMRC_FAIL;
/*@notreached@*/ break;
}
if (hdrPtr == NULL)
headerFree(*hdr);
- return 0;
+ return RPMRC_OK;
}
-int rpmReadPackageInfo(FD_t fd, Header * sigp, Header * hdrp)
+rpmRC rpmReadPackageInfo(FD_t fd, Header * sigp, Header * hdrp)
{
- int rc = readPackageHeaders(fd, NULL, sigp, hdrp);
- if (rc)
+ rpmRC rc = readPackageHeaders(fd, NULL, sigp, hdrp);
+ if (rc == RPMRC_FAIL)
return rc;
if (hdrp && *hdrp && sigp && *sigp)
headerMergeLegacySigs(*hdrp, *sigp);
return rc;
}
-int rpmReadPackageHeader(FD_t fd, Header * hdrp, int * isSource, int * major,
+rpmRC rpmReadPackageHeader(FD_t fd, Header * hdrp, int * isSource, int * major,
int * minor)
{
struct rpmlead lead;
Header sig = NULL;
- int rc = readPackageHeaders(fd, &lead, &sig, hdrp);
+ rpmRC rc = readPackageHeaders(fd, &lead, &sig, hdrp);
- if (rc)
+ if (rc == RPMRC_FAIL)
goto exit;
if (hdrp && *hdrp && sig) {
diff --git a/lib/psm.c b/lib/psm.c
index 0cd8e7d3e..005ef02a0 100644
--- a/lib/psm.c
+++ b/lib/psm.c
@@ -623,13 +623,14 @@ static int installArchive(const rpmTransactionSet ts, TFI_t fi, int allFiles)
}
}
- if (failedFile)
- free((void *)failedFile);
+ failedFile = _free(failedFile);
return rc;
}
-static int chkdir (const char * dpath, const char * dname)
+/**
+ */
+static rpmRC chkdir (const char * dpath, const char * dname)
{
struct stat st;
int rc;
@@ -653,42 +654,43 @@ static int chkdir (const char * dpath, const char * dname)
if (rc < 0) {
rpmError(RPMERR_CREATE, _("cannot create %s %s\n"),
dname, dpath);
- return 2;
+ return RPMRC_FAIL;
}
}
if ((rc = Access(dpath, W_OK))) {
rpmError(RPMERR_CREATE, _("cannot write to %s\n"), dpath);
- return 2;
+ return RPMRC_FAIL;
}
- return 0;
+ return RPMRC_OK;
}
/**
* @param ts transaction set
* @param fi transaction element file info
* @retval specFilePtr address of spec file name
- * @return 0 on success, 1 on bad magic, 2 on error
+ * @return rpmRC return code
*/
-static int installSources(const rpmTransactionSet ts, TFI_t fi,
+static rpmRC installSources(const rpmTransactionSet ts, TFI_t fi,
/*@out@*/ const char ** specFilePtr)
{
+ HFD_t hfd = fi->hfd;
const char * _sourcedir = rpmGenPath(ts->rootDir, "%{_sourcedir}", "");
const char * _specdir = rpmGenPath(ts->rootDir, "%{_specdir}", "");
const char * specFile = NULL;
- int rc = 0;
+ rpmRC rc = RPMRC_OK;
int i;
rpmMessage(RPMMESS_DEBUG, _("installing a source package\n"));
rc = chkdir(_sourcedir, "sourcedir");
if (rc) {
- rc = 2;
+ rc = RPMRC_FAIL;
goto exit;
}
rc = chkdir(_specdir, "specdir");
if (rc) {
- rc = 2;
+ rc = RPMRC_FAIL;
goto exit;
}
@@ -712,9 +714,7 @@ static int installSources(const rpmTransactionSet ts, TFI_t fi,
int sourcelen = strlen(_sourcedir) + 2;
char * t;
- if (fi->dnl) {
- free((void *)fi->dnl); fi->dnl = NULL;
- }
+ fi->dnl = hfd(fi->dnl, -1);
fi->dc = 2;
fi->dnl = xmalloc(fi->dc * sizeof(*fi->dnl) + fi->fc * sizeof(*fi->dil) +
@@ -738,17 +738,17 @@ static int installSources(const rpmTransactionSet ts, TFI_t fi,
rc = installArchive(ts, fi, 1);
if (rc) {
- rc = 2;
+ rc = RPMRC_FAIL;
goto exit;
}
exit:
- if (rc == 0 && specFile && specFilePtr)
+ if (rc == RPMRC_OK && specFile && specFilePtr)
*specFilePtr = specFile;
else
- free((void *)specFile);
- if (_specdir) free((void *)_specdir);
- if (_sourcedir) free((void *)_sourcedir);
+ specFile = _free(specFile);
+ _specdir = _free(_specdir);
+ _sourcedir = _free(_sourcedir);
return rc;
}
@@ -788,7 +788,7 @@ int rpmVersionCompare(Header first, Header second)
return rpmvercmp(one, two);
}
-int rpmInstallSourcePackage(const char * rootDir, FD_t fd,
+rpmRC rpmInstallSourcePackage(const char * rootDir, FD_t fd,
const char ** specFile,
rpmCallbackFunction notify, rpmCallbackData notifyData,
char ** cookie)
@@ -799,7 +799,7 @@ int rpmInstallSourcePackage(const char * rootDir, FD_t fd,
int isSource;
Header h;
int major, minor;
- int rc;
+ rpmRC rc;
int i;
ts->notify = notify;
@@ -811,7 +811,7 @@ int rpmInstallSourcePackage(const char * rootDir, FD_t fd,
if (!isSource) {
rpmError(RPMERR_NOTSRPM, _("source package expected, binary found\n"));
- rc = 2;
+ rc = RPMRC_FAIL;
goto exit;
}
@@ -821,7 +821,7 @@ int rpmInstallSourcePackage(const char * rootDir, FD_t fd,
*cookie = xstrdup(*cookie);
}
- rc = rpmtransAddPackage(ts, h, fd, NULL, 0, NULL);
+ (void) rpmtransAddPackage(ts, h, fd, NULL, 0, NULL);
fi->type = TR_ADDED;
fi->ap = ts->addedPackages.list;
diff --git a/lib/query.c b/lib/query.c
index 86542de80..ad3fb5fc2 100644
--- a/lib/query.c
+++ b/lib/query.c
@@ -15,6 +15,16 @@
/*@access Header@*/ /* XXX compared with NULL */
/*@access rpmdbMatchIterator@*/ /* XXX compared with NULL */
+/**
+ * Wrapper to free(3), hides const compilation noise, permit NULL, return NULL.
+ * @param this memory to free
+ * @retval NULL always
+ */
+static /*@null@*/ void * _free(/*@only@*/ /*@null@*/ const void * this) {
+ if (this) free((void *)this);
+ return NULL;
+}
+
/* ======================================================================== */
static char * permsString(int mode)
{
@@ -221,7 +231,7 @@ int showQueryPackage(QVA_t *qva, /*@unused@*/rpmdb rpmdb, Header h)
te = t + tb;
}
te = stpcpy(te, str);
- free((void *)str);
+ str = _free(str);
}
}
@@ -412,7 +422,7 @@ printNewSpecfile(Spec spec)
fmt[0] = '\0';
(void) stpcpy( stpcpy( stpcpy( fmt, "%{"), tn), "}\n");
- if (msgstr) free((void *)msgstr);
+ msgstr = _free(msgstr);
msgstr = headerSprintf(h, fmt, rpmTagTable, rpmHeaderFormats, &errstr);
if (msgstr == NULL) {
rpmError(RPMERR_QFMT, _("can't query %s: %s\n"), tn, errstr);
@@ -447,7 +457,7 @@ printNewSpecfile(Spec spec)
break;
}
}
- if (msgstr) free((void *)msgstr);
+ msgstr = _free(msgstr);
for (i = 0; i < sl->sl_nlines; i++) {
if (sl->sl_lines[i] == NULL)
@@ -521,6 +531,7 @@ int rpmQueryVerify(QVA_t *qva, rpmQVSources source, const char * arg,
case RPMQV_RPM:
{ int argc = 0;
const char ** argv = NULL;
+ rpmRC rpmrc;
int i;
rc = rpmGlob(arg, &argc, &argv);
@@ -543,12 +554,13 @@ int rpmQueryVerify(QVA_t *qva, rpmQVSources source, const char * arg,
break;
}
- retcode = rpmReadPackageHeader(fd, &h, &isSource, NULL, NULL);
+ rpmrc = rpmReadPackageHeader(fd, &h, &isSource, NULL, NULL);
Fclose(fd);
- switch (retcode) {
- case 0:
+ switch (rpmrc) {
+ case RPMRC_BADSIZE:
+ case RPMRC_OK:
if (h == NULL) {
rpmError(RPMERR_QUERY,
_("old format source packages cannot be queried\n"));
@@ -558,11 +570,12 @@ int rpmQueryVerify(QVA_t *qva, rpmQVSources source, const char * arg,
retcode = showPackage(qva, rpmdb, h);
headerFree(h);
break;
- case 1:
+ case RPMRC_BADMAGIC:
rpmError(RPMERR_QUERY,
_("%s does not appear to be a RPM package\n"), argv[i]);
/*@fallthrough@*/
- case 2:
+ case RPMRC_SHORTREAD:
+ case RPMRC_FAIL:
rpmError(RPMERR_QUERY,
_("query of %s failed\n"), argv[i]);
retcode = 1;
@@ -571,8 +584,8 @@ int rpmQueryVerify(QVA_t *qva, rpmQVSources source, const char * arg,
}
if (argv) {
for (i = 0; i < argc; i++)
- free((void *)argv[i]);
- free((void *)argv);
+ argv[i] = _free(argv[i]);
+ argv = _free(argv);
}
} break;
@@ -705,7 +718,7 @@ int rpmQueryVerify(QVA_t *qva, rpmQVSources source, const char * arg,
} else {
retcode = showMatches(qva, mi, showPackage);
}
- free((void *)fn);
+ fn = _free(fn);
} break;
case RPMQV_DBOFFSET:
diff --git a/lib/rpmchecksig.c b/lib/rpmchecksig.c
index 99a6cdccf..2a71118a0 100644
--- a/lib/rpmchecksig.c
+++ b/lib/rpmchecksig.c
@@ -119,7 +119,8 @@ int rpmReSign(rpmResignFlags add, char *passPhrase, const char **argv)
const char *sigtarget = NULL;
char tmprpm[1024+1];
Header sig = NULL;
- int rc = EXIT_FAILURE;
+ int res = EXIT_FAILURE;
+ rpmRC rc;
#ifdef ALPHA_LOSSAGE
l = malloc(sizeof(*l));
@@ -149,7 +150,8 @@ l = malloc(sizeof(*l));
break;
}
- if (rpmReadSignature(fd, &sig, l->signature_type)) {
+ rc = rpmReadSignature(fd, &sig, l->signature_type);
+ if (!(rc == RPMRC_OK || rc == RPMRC_BADSIZE)) {
rpmError(RPMERR_SIGGEN, _("%s: rpmReadSignature failed\n"), rpm);
goto exit;
}
@@ -214,12 +216,12 @@ l = malloc(sizeof(*l));
rename(trpm, rpm); tmprpm[0] = '\0';
}
- rc = 0;
+ res = 0;
exit:
if (l != &lead) free(l);
- if (fd) manageFile(&fd, NULL, 0, rc);
- if (ofd) manageFile(&ofd, NULL, 0, rc);
+ if (fd) manageFile(&fd, NULL, 0, res);
+ if (ofd) manageFile(&ofd, NULL, 0, res);
if (sig) {
rpmFreeSignature(sig);
@@ -235,7 +237,7 @@ if (l != &lead) free(l);
tmprpm[0] = '\0';
}
- return rc;
+ return res;
}
int rpmCheckSig(rpmCheckSigFlags flags, const char **argv)
@@ -255,6 +257,7 @@ int rpmCheckSig(rpmCheckSigFlags flags, const char **argv)
int_32 tag, type, count;
const void * ptr;
int res = 0;
+ rpmRC rc;
#ifdef ALPHA_LOSSAGE
l = malloc(sizeof(*l));
@@ -280,7 +283,9 @@ l = malloc(sizeof(*l));
default:
break;
}
- if (rpmReadSignature(fd, &sig, l->signature_type)) {
+
+ rc = rpmReadSignature(fd, &sig, l->signature_type);
+ if (!(rc == RPMRC_OK || rc == RPMRC_BADSIZE)) {
rpmError(RPMERR_SIGGEN, _("%s: rpmReadSignature failed\n"), rpm);
res++;
goto bottom;
diff --git a/lib/rpminstall.c b/lib/rpminstall.c
index c2ec21a05..17f90d7b6 100644
--- a/lib/rpminstall.c
+++ b/lib/rpminstall.c
@@ -297,6 +297,8 @@ int rpmInstall(const char * rootdir, const char ** fileArgv,
*/
for (fileURL = pkgURL; *fileURL; fileURL++) {
const char * fileName;
+ rpmRC rpmrc;
+
(void) urlPath(*fileURL, &fileName);
fd = Fopen(*fileURL, "r.ufdio");
if (fd == NULL || Ferror(fd)) {
@@ -308,10 +310,10 @@ int rpmInstall(const char * rootdir, const char ** fileArgv,
continue;
}
- rc = rpmReadPackageHeader(fd, &h, &isSource, &major, NULL);
+ rpmrc = rpmReadPackageHeader(fd, &h, &isSource, &major, NULL);
- switch (rc) {
- case 1:
+ switch (rpmrc) {
+ case RPMRC_BADMAGIC:
Fclose(fd);
rpmMessage(RPMMESS_ERROR,
_("%s does not appear to be a RPM package\n"),
@@ -319,12 +321,15 @@ int rpmInstall(const char * rootdir, const char ** fileArgv,
numFailed++;
pkgURL[i] = NULL;
break;
+ case RPMRC_FAIL:
+ case RPMRC_SHORTREAD:
default:
rpmMessage(RPMMESS_ERROR, _("%s cannot be installed\n"), *fileURL);
numFailed++;
pkgURL[i] = NULL;
break;
- case 0:
+ case RPMRC_BADSIZE:
+ case RPMRC_OK:
if (isSource) {
sourceURL[numSRPMS++] = fileName;
Fclose(fd);
@@ -484,9 +489,11 @@ int rpmInstall(const char * rootdir, const char ** fileArgv,
continue;
}
- if (!(transFlags & RPMTRANS_FLAG_TEST))
- numFailed += rpmInstallSourcePackage(rootdir, fd, NULL,
- showProgress, (void *) ((long)notifyFlags), NULL);
+ if (!(transFlags & RPMTRANS_FLAG_TEST)) {
+ rpmRC rpmrc = rpmInstallSourcePackage(rootdir, fd, NULL,
+ showProgress, (void *) ((long)notifyFlags), NULL);
+ if (rpmrc != RPMRC_OK) numFailed++;
+ }
Fclose(fd);
}
@@ -617,9 +624,11 @@ int rpmInstallSource(const char * rootdir, const char * arg,
if (rpmIsVerbose())
fprintf(stdout, _("Installing %s\n"), arg);
- rc = rpmInstallSourcePackage(rootdir, fd, specFile, NULL, NULL,
+ { rpmRC rpmrc = rpmInstallSourcePackage(rootdir, fd, specFile, NULL, NULL,
cookie);
- if (rc == 1) {
+ rc = (rpmrc == RPMRC_OK ? 0 : 1);
+ }
+ if (rc != 0) {
rpmMessage(RPMMESS_ERROR, _("%s cannot be installed\n"), arg);
if (specFile && *specFile) {
free((void *)*specFile);
diff --git a/lib/rpmlib.h b/lib/rpmlib.h
index 97ef774ad..afa44c5eb 100644
--- a/lib/rpmlib.h
+++ b/lib/rpmlib.h
@@ -16,6 +16,17 @@
#include "header.h"
#include "popt.h"
+/**
+ * Package read return codes.
+ */
+typedef enum rpmRC_e {
+ RPMRC_OK = 0,
+ RPMRC_BADMAGIC = 1,
+ RPMRC_FAIL = 2,
+ RPMRC_BADSIZE = 3,
+ RPMRC_SHORTREAD = 4,
+} rpmRC;
+
#ifdef __cplusplus
extern "C" {
#endif
@@ -25,9 +36,9 @@ extern "C" {
* @param fd file handle
* @retval signatures address of signatures pointer (or NULL)
* @retval hdr address of header pointer (or NULL)
- * @return 0 on success, 1 on bad magic, 2 on error
+ * @return rpmRC return code
*/
-int rpmReadPackageInfo(FD_t fd, /*@out@*/ Header * signatures,
+rpmRC rpmReadPackageInfo(FD_t fd, /*@out@*/ Header * signatures,
/*@out@*/ Header * hdr) /*@modifies fd, *signatures, *hdr @*/;
/**
@@ -37,9 +48,9 @@ int rpmReadPackageInfo(FD_t fd, /*@out@*/ Header * signatures,
* @retval isSource
* @retval major
* @retval minor
- * @return 0 on success, 1 on bad magic, 2 on error
+ * @return rpmRC return code
*/
-int rpmReadPackageHeader(FD_t fd, /*@out@*/ Header * hdr,
+rpmRC rpmReadPackageHeader(FD_t fd, /*@out@*/ Header * hdr,
/*@out@*/ int * isSource, /*@out@*/ int * major,
/*@out@*/ int * minor)
/*@modifies fd, *hdr, *isSource, *major, *minor @*/;
@@ -859,9 +870,9 @@ typedef struct rpmRelocation_s {
* @param notify progress callback
* @param notifyData progress callback private data
* @retval cooke address of cookie pointer
- * @return 0 on success, 1 on bad magic, 2 on error
+ * @return rpmRC return code
*/
-int rpmInstallSourcePackage(const char * root, FD_t fd,
+rpmRC rpmInstallSourcePackage(const char * root, FD_t fd,
/*@out@*/ const char ** specFile,
rpmCallbackFunction notify, rpmCallbackData notifyData,
/*@out@*/ char ** cookie)
diff --git a/lib/signature.c b/lib/signature.c
index 8f8606b9a..58bd4a782 100644
--- a/lib/signature.c
+++ b/lib/signature.c
@@ -103,35 +103,50 @@ const char * rpmDetectPGPVersion(pgpVersion * pgpVer)
return pgpbin;
}
-static inline int checkSize(FD_t fd, int siglen, int pad, int datalen)
+/**
+ * Check package size.
+ * @todo rpmio: use fdSize rather than fstat(2) to get file size.
+ * @param fd package file handle
+ * @param siglen signature header size
+ * @param pad signature padding
+ * @param datalen length of header+payload
+ * @return rpmRC return code
+ */
+static inline rpmRC checkSize(FD_t fd, int siglen, int pad, int datalen)
{
struct stat st;
+ rpmRC rc;
- fstat(Fileno(fd), &st);
+ if (fstat(Fileno(fd), &st))
+ return RPMRC_FAIL;
if (!S_ISREG(st.st_mode)) {
rpmMessage(RPMMESS_DEBUG,
_("file is not regular -- skipping size check\n"));
- return 0;
+ return RPMRC_OK;
}
- rpmMessage(RPMMESS_DEBUG,
+
+ rc = (((sizeof(struct rpmlead) + siglen + pad + datalen) - st.st_size)
+ ? RPMRC_BADSIZE : RPMRC_OK);
+
+ rpmMessage((rc == RPMRC_OK ? RPMMESS_DEBUG : RPMMESS_WARNING),
_("Expected size: %12d = lead(%d)+sigs(%d)+pad(%d)+data(%d)\n"),
sizeof(struct rpmlead)+siglen+pad+datalen,
sizeof(struct rpmlead), siglen, pad, datalen);
- rpmMessage(RPMMESS_DEBUG,
+ rpmMessage((rc == RPMRC_OK ? RPMMESS_DEBUG : RPMMESS_WARNING),
_(" Actual size: %12d\n"), st.st_size);
- return ((sizeof(struct rpmlead) + siglen + pad + datalen) - st.st_size);
+ return rc;
}
-int rpmReadSignature(FD_t fd, Header * headerp, sigType sig_type)
+rpmRC rpmReadSignature(FD_t fd, Header * headerp, sigType sig_type)
{
byte buf[2048];
int sigSize, pad;
int_32 type, count;
int_32 *archSize;
Header h = NULL;
- int rc = 1; /* assume failure */
+ rpmRC rc = RPMRC_FAIL; /* assume failure */
if (headerp)
*headerp = NULL;
@@ -144,7 +159,7 @@ int rpmReadSignature(FD_t fd, Header * headerp, sigType sig_type)
switch (sig_type) {
case RPMSIGTYPE_NONE:
rpmMessage(RPMMESS_DEBUG, _("No signature\n"));
- rc = 0;
+ rc = RPMRC_OK;
break;
case RPMSIGTYPE_PGP262_1024:
rpmMessage(RPMMESS_DEBUG, _("Old PGP signature\n"));
@@ -153,7 +168,7 @@ int rpmReadSignature(FD_t fd, Header * headerp, sigType sig_type)
break;
h = headerNew();
headerAddEntry(h, RPMSIGTAG_PGP, RPM_BIN_TYPE, buf, 152);
- rc = 0;
+ rc = RPMRC_OK;
break;
case RPMSIGTYPE_MD5:
case RPMSIGTYPE_MD5_PGP:
@@ -166,6 +181,8 @@ int rpmReadSignature(FD_t fd, Header * headerp, sigType sig_type)
h = headerRead(fd, HEADER_MAGIC_YES);
if (h == NULL)
break;
+
+ rc = RPMRC_OK;
sigSize = headerSizeof(h, HEADER_MAGIC_YES);
/* XXX Legacy headers have a HEADER_IMAGE tag added. */
@@ -177,14 +194,10 @@ int rpmReadSignature(FD_t fd, Header * headerp, sigType sig_type)
if (! headerGetEntry(h, RPMSIGTAG_SIZE, &type,
(void **)&archSize, &count))
break;
- if (checkSize(fd, sigSize, pad, *archSize))
- break;
- }
- if (pad) {
- if (timedRead(fd, buf, pad) != pad)
- break;
+ rc = checkSize(fd, sigSize, pad, *archSize);
}
- rc = 0;
+ if (pad && timedRead(fd, buf, pad) != pad)
+ rc = RPMRC_SHORTREAD;
break;
default:
break;
diff --git a/lib/signature.h b/lib/signature.h
index 4cd7c35a1..10fd504c0 100644
--- a/lib/signature.h
+++ b/lib/signature.h
@@ -48,9 +48,9 @@ Header rpmNewSignature(void);
* @param fd file handle
* @retval header address of (signature) header
* @param sig_type type of signature header to read (from lead).
- * @return 0 on success, 1 on error
+ * @return rpmRC return code
*/
-int rpmReadSignature(FD_t fd, /*@out@*/ Header *header, sigType sig_type);
+rpmRC rpmReadSignature(FD_t fd, /*@out@*/ Header *header, sigType sig_type);
/** \ingroup signature
* Write signature header.
diff --git a/lib/transaction.c b/lib/transaction.c
index 1a73cfa1d..d17068397 100644
--- a/lib/transaction.c
+++ b/lib/transaction.c
@@ -1721,13 +1721,14 @@ int rpmRunTransactions( rpmTransactionSet ts,
alp->key, ts->notifyData);
if (alp->fd) {
Header h;
+ rpmRC rpmrc;
headerFree(hdrs[i]);
hdrs[i] = NULL;
- rc = rpmReadPackageHeader(alp->fd, &h, NULL, NULL, NULL);
- if (rc) {
- (void)ts->notify(fi->h, RPMCALLBACK_INST_CLOSE_FILE, 0, 0,
- alp->key, ts->notifyData);
+ rpmrc = rpmReadPackageHeader(alp->fd, &h, NULL, NULL, NULL);
+ if (!(rpmrc == RPMRC_OK || rpmrc == RPMRC_BADSIZE)) {
+ (void)ts->notify(fi->h, RPMCALLBACK_INST_CLOSE_FILE,
+ 0, 0, alp->key, ts->notifyData);
alp->fd = NULL;
ourrc++;
} else {
diff --git a/po/rpm.pot b/po/rpm.pot
index 013d15296..8af360bf2 100644
--- a/po/rpm.pot
+++ b/po/rpm.pot
@@ -6,7 +6,7 @@
msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
-"POT-Creation-Date: 2001-02-12 10:41-0500\n"
+"POT-Creation-Date: 2001-02-12 13:55-0500\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
@@ -1472,7 +1472,7 @@ msgstr ""
msgid "no tar files given for build"
msgstr ""
-#: build/build.c:114 build/pack.c:381
+#: build/build.c:114 build/pack.c:384
msgid "Unable to open temp file.\n"
msgstr ""
@@ -1789,66 +1789,66 @@ msgstr ""
msgid "readRPM: %s is not an RPM package\n"
msgstr ""
-#: build/pack.c:281
+#: build/pack.c:284
#, c-format
msgid "readRPM: reading header from %s\n"
msgstr ""
-#: build/pack.c:393
+#: build/pack.c:396
msgid "Bad CSA data\n"
msgstr ""
-#: build/pack.c:434
+#: build/pack.c:437
#, c-format
msgid "Generating signature: %d\n"
msgstr ""
-#: build/pack.c:444
+#: build/pack.c:447
#, c-format
msgid "Could not open %s: %s\n"
msgstr ""
-#: build/pack.c:481 lib/psm.c:1304
+#: build/pack.c:484 lib/psm.c:1304
#, c-format
msgid "Unable to write package: %s\n"
msgstr ""
-#: build/pack.c:496
+#: build/pack.c:499
#, c-format
msgid "Unable to open sigtarget %s: %s\n"
msgstr ""
-#: build/pack.c:506
+#: build/pack.c:509
#, c-format
msgid "Unable to read header from %s: %s\n"
msgstr ""
-#: build/pack.c:520
+#: build/pack.c:523
#, c-format
msgid "Unable to write header to %s: %s\n"
msgstr ""
-#: build/pack.c:530
+#: build/pack.c:533
#, c-format
msgid "Unable to read payload from %s: %s\n"
msgstr ""
-#: build/pack.c:536
+#: build/pack.c:539
#, c-format
msgid "Unable to write payload to %s: %s\n"
msgstr ""
-#: build/pack.c:563 lib/psm.c:1360
+#: build/pack.c:566 lib/psm.c:1360
#, c-format
msgid "Wrote: %s\n"
msgstr ""
-#: build/pack.c:628
+#: build/pack.c:631
#, c-format
msgid "Could not generate output filename for package %s: %s\n"
msgstr ""
-#: build/pack.c:645
+#: build/pack.c:648
#, c-format
msgid "cannot create %s: %s\n"
msgstr ""
@@ -2626,11 +2626,11 @@ msgstr ""
msgid "error creating temporary file %s\n"
msgstr ""
-#: lib/package.c:118
+#: lib/package.c:119
msgid "packaging version 1 is not supported by this version of RPM\n"
msgstr ""
-#: lib/package.c:173
+#: lib/package.c:179
msgid ""
"only packaging with major numbers <= 4 is supported by this version of RPM\n"
msgstr ""
@@ -2928,17 +2928,17 @@ msgstr ""
msgid " on file "
msgstr ""
-#: lib/psm.c:654
+#: lib/psm.c:655
#, c-format
msgid "cannot create %s %s\n"
msgstr ""
-#: lib/psm.c:660
+#: lib/psm.c:661
#, c-format
msgid "cannot write to %s\n"
msgstr ""
-#: lib/psm.c:681
+#: lib/psm.c:683
msgid "installing a source package\n"
msgstr ""
@@ -2965,124 +2965,124 @@ msgstr ""
msgid "skipping %s-%s-%s install, %%pre scriptlet failed rc %d\n"
msgstr ""
-#: lib/query.c:151
+#: lib/query.c:161
#, c-format
msgid "incorrect format: %s\n"
msgstr ""
-#: lib/query.c:233
+#: lib/query.c:243
msgid "(contains no files)"
msgstr ""
-#: lib/query.c:284
+#: lib/query.c:294
msgid "normal "
msgstr ""
-#: lib/query.c:286
+#: lib/query.c:296
msgid "replaced "
msgstr ""
-#: lib/query.c:288
+#: lib/query.c:298
msgid "not installed "
msgstr ""
-#: lib/query.c:290
+#: lib/query.c:300
msgid "net shared "
msgstr ""
-#: lib/query.c:292
+#: lib/query.c:302
#, c-format
msgid "(unknown %3d) "
msgstr ""
-#: lib/query.c:297
+#: lib/query.c:307
msgid "(no state) "
msgstr ""
-#: lib/query.c:316 lib/query.c:361
+#: lib/query.c:326 lib/query.c:371
msgid "package has neither file owner or id lists\n"
msgstr ""
-#: lib/query.c:418
+#: lib/query.c:428
#, c-format
msgid "can't query %s: %s\n"
msgstr ""
#. XXX Fstrerror
-#: lib/query.c:534
+#: lib/query.c:545
#, c-format
msgid "open of %s failed: %s\n"
msgstr ""
-#: lib/query.c:554
+#: lib/query.c:566
msgid "old format source packages cannot be queried\n"
msgstr ""
-#: lib/query.c:563 lib/rpminstall.c:317
+#: lib/query.c:575 lib/rpminstall.c:319
#, c-format
msgid "%s does not appear to be a RPM package\n"
msgstr ""
-#: lib/query.c:567
+#: lib/query.c:580
#, c-format
msgid "query of %s failed\n"
msgstr ""
-#: lib/query.c:601
+#: lib/query.c:614
#, c-format
msgid "query of specfile %s failed, can't parse\n"
msgstr ""
-#: lib/query.c:624
+#: lib/query.c:637
msgid "no packages\n"
msgstr ""
-#: lib/query.c:635
+#: lib/query.c:648
#, c-format
msgid "group %s does not contain any packages\n"
msgstr ""
-#: lib/query.c:645
+#: lib/query.c:658
#, c-format
msgid "no package triggers %s\n"
msgstr ""
-#: lib/query.c:655
+#: lib/query.c:668
#, c-format
msgid "no package requires %s\n"
msgstr ""
-#: lib/query.c:666
+#: lib/query.c:679
#, c-format
msgid "no package provides %s\n"
msgstr ""
-#: lib/query.c:697
+#: lib/query.c:710
#, c-format
msgid "file %s: %s\n"
msgstr ""
-#: lib/query.c:701
+#: lib/query.c:714
#, c-format
msgid "file %s is not owned by any package\n"
msgstr ""
-#: lib/query.c:727
+#: lib/query.c:740
#, c-format
msgid "invalid package number: %s\n"
msgstr ""
-#: lib/query.c:730
+#: lib/query.c:743
#, c-format
msgid "package record number: %u\n"
msgstr ""
-#: lib/query.c:735
+#: lib/query.c:748
#, c-format
msgid "record %d could not be read\n"
msgstr ""
-#: lib/query.c:746 lib/rpminstall.c:558
+#: lib/query.c:759 lib/rpminstall.c:565
#, c-format
msgid "package %s is not installed\n"
msgstr ""
@@ -3106,67 +3106,67 @@ msgstr ""
msgid "%s: Fread failed: %s\n"
msgstr ""
-#: lib/rpmchecksig.c:136 lib/rpmchecksig.c:270
+#: lib/rpmchecksig.c:137 lib/rpmchecksig.c:273
#, c-format
msgid "%s: readLead failed\n"
msgstr ""
-#: lib/rpmchecksig.c:141
+#: lib/rpmchecksig.c:142
#, c-format
msgid "%s: Can't sign v1.0 RPM\n"
msgstr ""
-#: lib/rpmchecksig.c:145
+#: lib/rpmchecksig.c:146
#, c-format
msgid "%s: Can't re-sign v2.0 RPM\n"
msgstr ""
-#: lib/rpmchecksig.c:153 lib/rpmchecksig.c:284
+#: lib/rpmchecksig.c:155 lib/rpmchecksig.c:289
#, c-format
msgid "%s: rpmReadSignature failed\n"
msgstr ""
-#: lib/rpmchecksig.c:157 lib/rpmchecksig.c:289
+#: lib/rpmchecksig.c:159 lib/rpmchecksig.c:294
#, c-format
msgid "%s: No signature available\n"
msgstr ""
-#: lib/rpmchecksig.c:190
+#: lib/rpmchecksig.c:192
#, c-format
msgid "%s: writeLead failed: %s\n"
msgstr ""
-#: lib/rpmchecksig.c:196
+#: lib/rpmchecksig.c:198
#, c-format
msgid "%s: rpmWriteSignature failed: %s\n"
msgstr ""
-#: lib/rpmchecksig.c:276
+#: lib/rpmchecksig.c:279
#, c-format
msgid "%s: No signature available (v1.0 RPM)\n"
msgstr ""
-#: lib/rpmchecksig.c:438
+#: lib/rpmchecksig.c:443
msgid "NOT OK"
msgstr ""
-#: lib/rpmchecksig.c:439 lib/rpmchecksig.c:453
+#: lib/rpmchecksig.c:444 lib/rpmchecksig.c:458
msgid " (MISSING KEYS:"
msgstr ""
-#: lib/rpmchecksig.c:441 lib/rpmchecksig.c:455
+#: lib/rpmchecksig.c:446 lib/rpmchecksig.c:460
msgid ") "
msgstr ""
-#: lib/rpmchecksig.c:442 lib/rpmchecksig.c:456
+#: lib/rpmchecksig.c:447 lib/rpmchecksig.c:461
msgid " (UNTRUSTED KEYS:"
msgstr ""
-#: lib/rpmchecksig.c:444 lib/rpmchecksig.c:458
+#: lib/rpmchecksig.c:449 lib/rpmchecksig.c:463
msgid ")"
msgstr ""
-#: lib/rpmchecksig.c:452
+#: lib/rpmchecksig.c:457
msgid "OK"
msgstr ""
@@ -3366,69 +3366,69 @@ msgstr ""
msgid "retrieved %d packages\n"
msgstr ""
-#: lib/rpminstall.c:303 lib/rpminstall.c:481
+#: lib/rpminstall.c:305 lib/rpminstall.c:486
#, c-format
msgid "cannot open file %s: %s\n"
msgstr ""
-#: lib/rpminstall.c:323 lib/rpminstall.c:623
+#: lib/rpminstall.c:327 lib/rpminstall.c:632
#, c-format
msgid "%s cannot be installed\n"
msgstr ""
-#: lib/rpminstall.c:338
+#: lib/rpminstall.c:343
#, c-format
msgid "cannot open Packages database in %s\n"
msgstr ""
-#: lib/rpminstall.c:360
+#: lib/rpminstall.c:365
#, c-format
msgid "package %s is not relocateable\n"
msgstr ""
-#: lib/rpminstall.c:405
+#: lib/rpminstall.c:410
#, c-format
msgid "error reading from file %s\n"
msgstr ""
-#: lib/rpminstall.c:410
+#: lib/rpminstall.c:415
#, c-format
msgid "file %s requires a newer version of RPM\n"
msgstr ""
-#: lib/rpminstall.c:427
+#: lib/rpminstall.c:432
#, c-format
msgid "found %d source and %d binary packages\n"
msgstr ""
-#: lib/rpminstall.c:440
+#: lib/rpminstall.c:445
msgid "failed dependencies:\n"
msgstr ""
-#: lib/rpminstall.c:461
+#: lib/rpminstall.c:466
msgid "installing binary packages\n"
msgstr ""
-#: lib/rpminstall.c:545
+#: lib/rpminstall.c:552
#, c-format
msgid "cannot open %s/packages.rpm\n"
msgstr ""
-#: lib/rpminstall.c:561
+#: lib/rpminstall.c:568
#, c-format
msgid "\"%s\" specifies multiple packages\n"
msgstr ""
-#: lib/rpminstall.c:584
+#: lib/rpminstall.c:591
msgid "removing these packages would break dependencies:\n"
msgstr ""
-#: lib/rpminstall.c:612
+#: lib/rpminstall.c:619
#, c-format
msgid "cannot open %s: %s\n"
msgstr ""
-#: lib/rpminstall.c:618
+#: lib/rpminstall.c:625
#, c-format
msgid "Installing %s\n"
msgstr ""
@@ -3543,121 +3543,121 @@ msgstr ""
msgid "execution of %s scriptlet from %s-%s-%s failed, exit status %d\n"
msgstr ""
-#: lib/signature.c:114
+#: lib/signature.c:125
msgid "file is not regular -- skipping size check\n"
msgstr ""
-#: lib/signature.c:118
+#: lib/signature.c:133
#, c-format
msgid "Expected size: %12d = lead(%d)+sigs(%d)+pad(%d)+data(%d)\n"
msgstr ""
-#: lib/signature.c:122
+#: lib/signature.c:137
#, c-format
msgid " Actual size: %12d\n"
msgstr ""
-#: lib/signature.c:146
+#: lib/signature.c:161
msgid "No signature\n"
msgstr ""
-#: lib/signature.c:150
+#: lib/signature.c:165
msgid "Old PGP signature\n"
msgstr ""
-#: lib/signature.c:161
+#: lib/signature.c:176
msgid "Old (internal-only) signature! How did you get that!?\n"
msgstr ""
-#: lib/signature.c:217
+#: lib/signature.c:230
#, c-format
msgid "Signature: size(%d)+pad(%d)\n"
msgstr ""
-#: lib/signature.c:276
+#: lib/signature.c:289
#, c-format
msgid "Couldn't exec pgp (%s)\n"
msgstr ""
-#: lib/signature.c:287
+#: lib/signature.c:300
msgid "pgp failed\n"
msgstr ""
#. PGP failed to write signature
#. Just in case
-#: lib/signature.c:294
+#: lib/signature.c:307
msgid "pgp failed to write signature\n"
msgstr ""
-#: lib/signature.c:299
+#: lib/signature.c:312
#, c-format
msgid "PGP sig size: %d\n"
msgstr ""
-#: lib/signature.c:310 lib/signature.c:387
+#: lib/signature.c:323 lib/signature.c:400
msgid "unable to read the signature\n"
msgstr ""
-#: lib/signature.c:315
+#: lib/signature.c:328
#, c-format
msgid "Got %d bytes of PGP sig\n"
msgstr ""
-#: lib/signature.c:353 lib/signature.c:699
+#: lib/signature.c:366 lib/signature.c:712
msgid "Couldn't exec gpg\n"
msgstr ""
-#: lib/signature.c:364
+#: lib/signature.c:377
msgid "gpg failed\n"
msgstr ""
#. GPG failed to write signature
#. Just in case
-#: lib/signature.c:371
+#: lib/signature.c:384
msgid "gpg failed to write signature\n"
msgstr ""
-#: lib/signature.c:376
+#: lib/signature.c:389
#, c-format
msgid "GPG sig size: %d\n"
msgstr ""
-#: lib/signature.c:392
+#: lib/signature.c:405
#, c-format
msgid "Got %d bytes of GPG sig\n"
msgstr ""
-#: lib/signature.c:420
+#: lib/signature.c:433
msgid "Generating signature using PGP.\n"
msgstr ""
-#: lib/signature.c:426
+#: lib/signature.c:439
msgid "Generating signature using GPG.\n"
msgstr ""
-#: lib/signature.c:506 lib/signature.c:567
+#: lib/signature.c:519 lib/signature.c:580
msgid "Could not run pgp. Use --nopgp to skip PGP checks.\n"
msgstr ""
-#: lib/signature.c:640
+#: lib/signature.c:653
msgid "Could not run gpg. Use --nogpg to skip GPG checks.\n"
msgstr ""
-#: lib/signature.c:728
+#: lib/signature.c:741
msgid "Couldn't exec pgp\n"
msgstr ""
#. @notreached@
#. This case should have been screened out long ago.
-#: lib/signature.c:732 lib/signature.c:785
+#: lib/signature.c:745 lib/signature.c:798
msgid "Invalid %%_signature spec in macro file\n"
msgstr ""
-#: lib/signature.c:765
+#: lib/signature.c:778
msgid "You must set \"%%_gpg_name\" in your macro file\n"
msgstr ""
-#: lib/signature.c:777
+#: lib/signature.c:790
msgid "You must set \"%%_pgp_name\" in your macro file\n"
msgstr ""
diff --git a/python/rpmmodule.c b/python/rpmmodule.c
index aa8ef181c..c092ac6ae 100644
--- a/python/rpmmodule.c
+++ b/python/rpmmodule.c
@@ -1703,10 +1703,10 @@ static PyObject * rpmHeaderFromPackage(PyObject * self, PyObject * args) {
hdrObject * h;
Header header;
Header sigs;
- int rc;
FD_t fd;
int rawFd;
int isSource = 0;
+ rpmRC rc;
if (!PyArg_ParseTuple(args, "i", &rawFd)) return NULL;
fd = fdDup(rawFd);
@@ -1715,7 +1715,8 @@ static PyObject * rpmHeaderFromPackage(PyObject * self, PyObject * args) {
Fclose(fd);
switch (rc) {
- case 0:
+ case RPMRC_BADSIZE:
+ case RPMRC_OK:
h = (hdrObject *) PyObject_NEW(PyObject, &hdrType);
h->h = header;
h->sigs = sigs;
@@ -1726,12 +1727,14 @@ static PyObject * rpmHeaderFromPackage(PyObject * self, PyObject * args) {
isSource = 1;
break;
- case 1:
+ case RPMRC_BADMAGIC:
Py_INCREF(Py_None);
h = (hdrObject *) Py_None;
break;
- default:
+ case RPMRC_FAIL:
+ case RPMRC_SHORTREAD:
+ default:
PyErr_SetString(pyrpmError, "error reading package");
return NULL;
}
diff --git a/tools/rpmsort.c b/tools/rpmsort.c
index f273e040a..441ec6d92 100644
--- a/tools/rpmsort.c
+++ b/tools/rpmsort.c
@@ -39,6 +39,7 @@ do_tsort(const char *fileArgv[])
for (fileURL = fileArgv; *fileURL; fileURL++) {
const char * fileName;
+ rpmRC rpmrc;
FD_t fd;
(void) urlPath(*fileURL, &fileName);
@@ -51,7 +52,7 @@ do_tsort(const char *fileArgv[])
continue;
}
- rc = rpmReadPackageHeader(fd, &h, NULL, NULL, NULL);
+ rpmrc = rpmReadPackageHeader(fd, &h, NULL, NULL, NULL);
rc = rpmtransAddPackage(ts, h, NULL, fileName, 0, NULL);