summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/falloc.c2
-rw-r--r--lib/formats.c4
-rw-r--r--lib/fprint.h20
-rw-r--r--lib/install.c4
-rw-r--r--lib/macro.c3
-rw-r--r--lib/misc.c2
-rw-r--r--lib/misc.h2
-rw-r--r--lib/rpmdb.c2
-rw-r--r--lib/rpmio.h48
-rw-r--r--lib/rpmlib.h3
-rw-r--r--lib/transaction.c13
-rw-r--r--lib/url.c8
-rw-r--r--lib/verify.c2
13 files changed, 64 insertions, 49 deletions
diff --git a/lib/falloc.c b/lib/falloc.c
index 6cf8e5bb7..3839b2e5f 100644
--- a/lib/falloc.c
+++ b/lib/falloc.c
@@ -43,7 +43,7 @@ FD_t fadOpen(const char * path, int flags, int perms)
if (flags & O_WRONLY)
return NULL;
- fd = ufdio->open(path, flags, perms);
+ fd = ufdio->_open(path, flags, perms);
if (Ferror(fd))
/* XXX Fstrerror */
return NULL;
diff --git a/lib/formats.c b/lib/formats.c
index 26801cb61..77869d36e 100644
--- a/lib/formats.c
+++ b/lib/formats.c
@@ -208,7 +208,7 @@ static int fssizesTag(Header h, int_32 * type, void ** data, int_32 * count,
numFiles = 0;
filenames = NULL;
} else {
- buildFileList(h, &filenames, &numFiles);
+ rpmBuildFileList(h, &filenames, &numFiles);
}
if (rpmGetFilesystemList(NULL, count)) {
@@ -339,7 +339,7 @@ static int filenamesTag(Header h, int_32 * type, /*@out@*/void ** data,
int_32 * count, int * freeData) {
*type = RPM_STRING_ARRAY_TYPE;
- buildFileList(h, (const char ***) data, count);
+ rpmBuildFileList(h, (const char ***) data, count);
*freeData = 1;
*freeData = 0; /* XXX WTFO? */
diff --git a/lib/fprint.h b/lib/fprint.h
index 2dae67630..2afc9d27b 100644
--- a/lib/fprint.h
+++ b/lib/fprint.h
@@ -27,10 +27,22 @@ typedef struct fingerprint_s {
/* only if !scarceMemory */
#define fpFree(a) free((void *)(a).baseName)
-#define FP_EQUAL(a, b) ((&(a) == &(b)) || \
- (((a).entry == (b).entry) && \
- !strcmp((a).subDir, (b).subDir) && \
- !strcmp((a).baseName, (b).baseName)))
+#define FP_EQUAL(a, b) ( \
+ (&(a) == &(b)) || ( \
+ ((a).entry == (b).entry) && \
+ !strcmp((a).subDir, (b).subDir) && \
+ !strcmp((a).baseName, (b).baseName) \
+ ))
+
+#define FP_ENTRY_EQUAL(a, b) ( \
+ ((a)->dev == (b)->dev) && \
+ ((a)->ino == (b)->ino) && \
+ !strcmp((a)->dirName, (b)->dirName))
+
+#define FP_EQUAL_DIFFERENT_CACHE(a, b) ( \
+ FP_ENTRY_EQUAL((a).entry, (b).entry) && \
+ !strcmp((a).subDir, (b).subDir) && \
+ !strcmp((a).baseName, (b).baseName))
#ifdef __cplusplus
extern "C" {
diff --git a/lib/install.c b/lib/install.c
index f965e7e9e..842e05bae 100644
--- a/lib/install.c
+++ b/lib/install.c
@@ -109,12 +109,12 @@ static int assembleFileList(Header h, /*@out@*/ struct fileMemory ** memPtr,
if (!headerIsEntry(h, RPMTAG_COMPFILELIST)) return 0;
- buildFileList(h, &mem->names, fileCountPtr);
+ rpmBuildFileList(h, &mem->names, fileCountPtr);
if (headerIsEntry(h, RPMTAG_ORIGCOMPFILELIST)) {
buildOrigFileList(h, &mem->cpioNames, fileCountPtr);
} else {
- buildFileList(h, &mem->cpioNames, fileCountPtr);
+ rpmBuildFileList(h, &mem->cpioNames, fileCountPtr);
}
fileCount = *fileCountPtr;
diff --git a/lib/macro.c b/lib/macro.c
index 0323f2873..4d965a774 100644
--- a/lib/macro.c
+++ b/lib/macro.c
@@ -203,7 +203,8 @@ rdcl(char *buf, size_t size, FD_t fd, int escapes)
*q = '\0';
do {
- if (fgets(q, size, fpio->ffileno(fd)) == NULL) /* read next line */
+ /* read next line */
+ if (fgets(q, size, (FILE *)fdGetFp(fd)) == NULL)
break;
nb = strlen(q);
nread += nb;
diff --git a/lib/misc.c b/lib/misc.c
index 9882a7ffa..969ff8bd6 100644
--- a/lib/misc.c
+++ b/lib/misc.c
@@ -601,7 +601,7 @@ void expandFilelist(Header h)
}
-void buildFileList(Header h, const char *** fileListPtr, int * fileCountPtr)
+void rpmBuildFileList(Header h, const char *** fileListPtr, int * fileCountPtr)
{
doBuildFileList(h, fileListPtr, fileCountPtr,RPMTAG_COMPFILELIST,
RPMTAG_COMPDIRLIST, RPMTAG_COMPFILEDIRS);
diff --git a/lib/misc.h b/lib/misc.h
index 336e73670..9942e7a7c 100644
--- a/lib/misc.h
+++ b/lib/misc.h
@@ -37,8 +37,6 @@ int makeTempFile(const char * prefix, /*@out@*/ const char ** fnptr,
char * currentDirectory(void); /* result needs to be freed */
void compressFilelist(Header h);
void expandFilelist(Header h);
-void buildFileList(Header h, /*@out@*/ const char *** fileListPtr,
- /*@out@*/ int * fileCountPtr);
void buildOrigFileList(Header h, /*@out@*/ const char *** fileListPtr,
/*@out@*/ int * fileCountPtr);
diff --git a/lib/rpmdb.c b/lib/rpmdb.c
index 7e59ae7ed..c45f76274 100644
--- a/lib/rpmdb.c
+++ b/lib/rpmdb.c
@@ -962,7 +962,7 @@ int rpmdbFindFpList(rpmdb db, fingerPrint * fpList, dbiIndexSet * matchList,
/* Add db (recnum,filenum) to list for fingerprint matches. */
for (i = 0; i < num; i++) {
j = im[i].fpNum;
- if (FP_EQUAL(fps[i], fpList[j]))
+ if (FP_EQUAL_DIFFERENT_CACHE(fps[i], fpList[j]))
dbiAppendIndexRecord(&matchList[j], im[i].rec);
}
diff --git a/lib/rpmio.h b/lib/rpmio.h
index 05430a3ae..23ec78f7d 100644
--- a/lib/rpmio.h
+++ b/lib/rpmio.h
@@ -62,18 +62,18 @@ struct FDIO_s {
fdio_ref_function_t * ref;
fdio_deref_function_t * deref;
fdio_new_function_t * new;
- fdio_fileno_function_t * fileno;
-
- fdio_open_function_t * open;
- fdio_fopen_function_t * fopen;
- fdio_ffileno_function_t * ffileno;
- fdio_fflush_function_t * fflush;
-
- fdio_mkdir_function_t * mkdir;
- fdio_chdir_function_t * chdir;
- fdio_rmdir_function_t * rmdir;
- fdio_rename_function_t * rename;
- fdio_unlink_function_t * unlink;
+ fdio_fileno_function_t * _fileno;
+
+ fdio_open_function_t * _open;
+ fdio_fopen_function_t * _fopen;
+ fdio_ffileno_function_t * _ffileno;
+ fdio_fflush_function_t * _fflush;
+
+ fdio_mkdir_function_t * _mkdir;
+ fdio_chdir_function_t * _chdir;
+ fdio_rmdir_function_t * _rmdir;
+ fdio_rename_function_t * _rename;
+ fdio_unlink_function_t * _unlink;
};
/*@observer@*/ const char * Fstrerror(FD_t fd);
@@ -147,8 +147,8 @@ extern /*@null@*/ FILE *fdFdopen( /*@only@*/ void * cookie, const char * mode);
#define fdNew(_msg) fdio->new(_msg, __FILE__, __LINE__)
#if 0
-#define fdFileno fdio->fileno
-#define fdOpen fdio->open
+#define fdFileno fdio->_fileno
+#define fdOpen fdio->_open
#endif
int fdWritable(FD_t fd, int secs);
@@ -195,16 +195,16 @@ const char *const ftpStrerror(int errorNumber);
#define ufdLink ufdio->ref
#define ufdFree ufdio->deref
#define ufdNew ufdio->new
-#define ufdFileno ufdio->fileno
-#define ufdOpen ufdio->open
-#define ufdFopen ufdio->fopen
-#define ufdFfileno ufdio->ffileno
-#define ufdFflush ufdio->fflush
-#define ufdMkdir ufdio->mkdir
-#define ufdChdir ufdio->chdir
-#define ufdRmdir ufdio->rmdir
-#define ufdRename ufdio->rename
-#define ufdUnlink ufdio->unlink
+#define ufdFileno ufdio->_fileno
+#define ufdOpen ufdio->_open
+#define ufdFopen ufdio->_fopen
+#define ufdFfileno ufdio->_ffileno
+#define ufdFflush ufdio->_fflush
+#define ufdMkdir ufdio->_mkdir
+#define ufdChdir ufdio->_chdir
+#define ufdRmdir ufdio->_rmdir
+#define ufdRename ufdio->_rename
+#define ufdUnlink ufdio->_unlink
#endif
int timedRead(FD_t fd, /*@out@*/ void * bufptr, int length);
diff --git a/lib/rpmlib.h b/lib/rpmlib.h
index 28ee09123..000b28bc7 100644
--- a/lib/rpmlib.h
+++ b/lib/rpmlib.h
@@ -22,6 +22,9 @@ int rpmReadPackageHeader(FD_t fd, /*@out@*/ Header * hdr,
int headerNVR(Header h, /*@out@*/ const char **np, /*@out@*/ const char **vp,
/*@out@*/ const char **rp);
+void rpmBuildFileList(Header h, /*@out@*/ const char *** fileListPtr,
+ /*@out@*/ int * fileCountPtr);
+
/* 0 = success */
/* 1 = bad magic */
/* 2 = error */
diff --git a/lib/transaction.c b/lib/transaction.c
index 86c581715..712d231df 100644
--- a/lib/transaction.c
+++ b/lib/transaction.c
@@ -740,7 +740,8 @@ static int handleInstInstalledFiles(TFI_t * fi, rpmdb db,
uint_16 * otherModes;
int numReplaced = 0;
- if ((h = rpmdbGetRecord(db, shared->otherPkg)) == NULL)
+ h = rpmdbGetRecord(db, shared->otherPkg);
+ if (h == NULL)
return 1;
headerGetEntryMinMemory(h, RPMTAG_FILEMD5S, NULL,
@@ -775,7 +776,7 @@ static int handleInstInstalledFiles(TFI_t * fi, rpmdb db,
if (reportConflicts)
psAppendFile(probs, RPMPROB_FILE_CONFLICT, fi->ap->key,
fi->ap->h, fi->dnl[fi->dil[fileNum]],
- fi->bnl[fileNum], h,0 );
+ fi->bnl[fileNum], h, 0);
if (!(otherFlags[otherFileNum] | fi->fflags[fileNum])
& RPMFILE_CONFIG) {
if (!shared->isRemoved)
@@ -820,7 +821,8 @@ static int handleRmvdInstalledFiles(TFI_t * fi, rpmdb db,
const char * otherStates;
int i;
- if ((h = rpmdbGetRecord(db, shared->otherPkg)) == NULL)
+ h = rpmdbGetRecord(db, shared->otherPkg);
+ if (h == NULL)
return 1;
headerGetEntryMinMemory(h, RPMTAG_FILESTATES, NULL,
@@ -1249,8 +1251,8 @@ int rpmRunTransactions(rpmTransactionSet ts, rpmCallbackFunction notify,
* - count files.
*/
/* The ordering doesn't matter here */
- for (alp = ts->addedPackages.list; (alp - ts->addedPackages.list) <
- ts->addedPackages.size; alp++) {
+ for (alp = ts->addedPackages.list;
+ (alp - ts->addedPackages.list) < ts->addedPackages.size; alp++) {
if (!archOkay(alp->h) && !(ignoreSet & RPMPROB_FILTER_IGNOREARCH))
psAppend(probs, RPMPROB_BADARCH, alp->key, alp->h, NULL, NULL, 0);
@@ -1341,7 +1343,6 @@ int rpmRunTransactions(rpmTransactionSet ts, rpmCallbackFunction notify,
fi->type = TR_REMOVED;
break;
}
-
if (!headerGetEntry(fi->h, RPMTAG_COMPFILELIST, NULL,
(void **) &fi->bnl, &fi->fc)) {
/* This catches removed packages w/ no file lists */
diff --git a/lib/url.c b/lib/url.c
index 361d1685c..adfb776da 100644
--- a/lib/url.c
+++ b/lib/url.c
@@ -68,9 +68,9 @@ DBGREFS(0, (stderr, "--> url %p -- %d %s at %s:%u\n", u, u->nrefs, msg, file, li
#ifndef NOTYET
FILE * fp = fdGetFp(u->ctrl);
if (fp) {
- fdPush(u->ctrl, fpio, fp, fileno(fp)); /* Push fpio onto stack */
+ fdPush(u->ctrl, fpio, fp, -1); /* Push fpio onto stack */
Fclose(u->ctrl);
- } else if (fdio->fileno(u->ctrl) >= 0)
+ } else if (fdio->_fileno(u->ctrl) >= 0)
fdio->close(u->ctrl);
#else
Fclose(u->ctrl);
@@ -85,9 +85,9 @@ DBGREFS(0, (stderr, "--> url %p -- %d %s at %s:%u\n", u, u->nrefs, msg, file, li
#ifndef NOTYET
FILE * fp = fdGetFp(u->data);
if (fp) {
- fdPush(u->data, fpio, fp, fileno(fp)); /* Push fpio onto stack */
+ fdPush(u->data, fpio, fp, -1); /* Push fpio onto stack */
Fclose(u->data);
- } else if (fdio->fileno(u->data) >= 0)
+ } else if (fdio->_fileno(u->data) >= 0)
fdio->close(u->data);
#else
Fclose(u->ctrl);
diff --git a/lib/verify.c b/lib/verify.c
index b44f67f63..1314601fc 100644
--- a/lib/verify.c
+++ b/lib/verify.c
@@ -259,7 +259,7 @@ static int verifyHeader(QVA_t *qva, Header h)
if (headerGetEntry(h, RPMTAG_FILEFLAGS, NULL, (void **) &fileFlagsList, NULL) &&
headerIsEntry(h, RPMTAG_COMPFILELIST)) {
- buildFileList(h, &fileNames, &count);
+ rpmBuildFileList(h, &fileNames, &count);
for (i = 0; i < count; i++) {
if ((rc = rpmVerifyFile(qva->qva_prefix, h, i, &verifyResult, omitMask)) != 0) {