summaryrefslogtreecommitdiff
path: root/lib/misc.c
diff options
context:
space:
mode:
authorjbj <devnull@localhost>2001-06-05 19:26:22 +0000
committerjbj <devnull@localhost>2001-06-05 19:26:22 +0000
commit4ae69250a2595531743074d81aec5804a1b5573f (patch)
treec0eb69d1a276ee9421a12745eae40bcfaa122dfa /lib/misc.c
parent750d54d8a33e67d8f89ed95a785c0f025c833aa8 (diff)
downloadlibrpm-tizen-4ae69250a2595531743074d81aec5804a1b5573f.tar.gz
librpm-tizen-4ae69250a2595531743074d81aec5804a1b5573f.tar.bz2
librpm-tizen-4ae69250a2595531743074d81aec5804a1b5573f.zip
- fix typos in linux.{req,prov}.
CVS patchset: 4834 CVS date: 2001/06/05 19:26:22
Diffstat (limited to 'lib/misc.c')
-rw-r--r--lib/misc.c21
1 files changed, 15 insertions, 6 deletions
diff --git a/lib/misc.c b/lib/misc.c
index a0d2fee81..e9693e69d 100644
--- a/lib/misc.c
+++ b/lib/misc.c
@@ -17,7 +17,8 @@ static int _debug = 0;
/*@access FD_t@*/ /* XXX compared with NULL */
/*@-exportheadervar@*/
-/*@unused@*/ char * RPMVERSION = VERSION; /* just to put a marker in librpm.a */
+/* just to put a marker in librpm.a */
+/*@unused@*/ /*@observer@*/ char * RPMVERSION = VERSION;
/*@=exportheadervar@*/
char ** splitString(const char * str, int length, char sep)
@@ -414,6 +415,8 @@ void compressFilelist(Header h)
if (!hge(h, RPMTAG_OLDFILENAMES, &fnt, (void **) &fileNames, &count))
return; /* no file list */
+ if (fileNames == NULL || count <= 0)
+ return;
dirNames = alloca(sizeof(*dirNames) * count); /* worst case */
baseNames = alloca(sizeof(*dirNames) * count);
@@ -432,10 +435,14 @@ void compressFilelist(Header h)
for (i = 0; i < count; i++) {
const char ** needle;
- char *baseName = strrchr(fileNames[i], '/') + 1;
char savechar;
- int len = baseName - fileNames[i];
+ char * baseName;
+ int len;
+ if (fileNames[i] == NULL) /* XXX can't happen */
+ continue;
+ baseName = strrchr(fileNames[i], '/') + 1;
+ len = baseName - fileNames[i];
needle = dirNames;
savechar = *baseName;
*baseName = '\0';
@@ -454,12 +461,14 @@ void compressFilelist(Header h)
}
exit:
- (void) headerAddEntry(h, RPMTAG_DIRINDEXES, RPM_INT32_TYPE,
+ if (count > 0) {
+ (void) headerAddEntry(h, RPMTAG_DIRINDEXES, RPM_INT32_TYPE,
dirIndexes, count);
- (void) headerAddEntry(h, RPMTAG_BASENAMES, RPM_STRING_ARRAY_TYPE,
+ (void) headerAddEntry(h, RPMTAG_BASENAMES, RPM_STRING_ARRAY_TYPE,
baseNames, count);
- (void) headerAddEntry(h, RPMTAG_DIRNAMES, RPM_STRING_ARRAY_TYPE,
+ (void) headerAddEntry(h, RPMTAG_DIRNAMES, RPM_STRING_ARRAY_TYPE,
dirNames, dirIndex + 1);
+ }
fileNames = headerFreeData(fileNames, fnt);