- yet more boring lclint annotations and fiddles.

CVS patchset: 4732
CVS date: 2001/04/30 22:32:22
This commit is contained in:
jbj 2001-04-30 22:32:22 +00:00
parent a57a13b135
commit 0ecdbba935
54 changed files with 1677 additions and 1527 deletions

View File

@ -39,6 +39,7 @@
- transaction iterator(s) need to run in reverse order on pure erasures.
- erasures not yet strict, warn & chug on unlink(2)/rmdir(2) failure.
- more boring lclint annotations and fiddles.
- yet more boring lclint annotations and fiddles.
4.0 -> 4.0.[12]
- add doxygen and lclint annotations most everywhere.

View File

@ -11,20 +11,14 @@
-unrecogcomments
# don't-bother-me-yet parameters
-branchstate
#-immediatetrans
-mustfree
#-observertrans
#-statictrans
-branchstate # ~39
-mustfree # ~325
# not-yet normal parameters
-boolops # w->n
-fixedformalarray
-null
-predboolint # w->n
-predboolothers # w->n
-retvalint # w->n
-type
-boolops # ~351 w->n
#-null # ~68
-predboolint # ~200 w->n
-type # ~271
# -weak paramaters

View File

@ -13,6 +13,7 @@
static int _build_debug = 0;
/*@access StringBuf @*/
/*@access urlinfo @*/ /* XXX compared with NULL */
/*@access FD_t @*/
/**
@ -29,7 +30,7 @@ static void doRmSource(Spec spec)
for (p = spec->sources; p != NULL; p = p->next) {
if (! (p->flags & RPMBUILD_ISNO)) {
const char *fn = rpmGetPath("%{_sourcedir}/", p->source, NULL);
Unlink(fn);
(void) Unlink(fn);
fn = _free(fn);
}
}
@ -38,7 +39,7 @@ static void doRmSource(Spec spec)
for (p = pkg->icon; p != NULL; p = p->next) {
if (! (p->flags & RPMBUILD_ISNO)) {
const char *fn = rpmGetPath("%{_sourcedir}/", p->source, NULL);
Unlink(fn);
(void) Unlink(fn);
fn = _free(fn);
}
}
@ -147,7 +148,7 @@ int doScript(Spec spec, int what, const char *name, StringBuf sb, int test)
buildTemplate = rpmExpand(mTemplate, NULL);
buildPost = rpmExpand(mPost, NULL);
fputs(buildTemplate, fp);
(void) fputs(buildTemplate, fp);
if (what != RPMBUILD_PREP && what != RPMBUILD_RMBUILD && spec->buildSubdir)
fprintf(fp, "cd %s\n", spec->buildSubdir);
@ -158,9 +159,9 @@ int doScript(Spec spec, int what, const char *name, StringBuf sb, int test)
} else
fprintf(fp, "%s", getStringBuf(sb));
fputs(buildPost, fp);
(void) fputs(buildPost, fp);
Fclose(xfd);
(void) Fclose(xfd);
if (test) {
rc = 0;
@ -174,7 +175,7 @@ fprintf(stderr, "*** rootURL %s buildDirURL %s\n", rootURL, buildDirURL);
rc = RPMERR_SCRIPT;
goto exit;
}
if (u) {
if (u != NULL) {
switch (u->urltype) {
case URL_IS_FTP:
if (_build_debug)
@ -191,13 +192,13 @@ fprintf(stderr, "*** addMacros\n");
}
buildCmd = rpmExpand("%{___build_cmd}", " ", buildScript, NULL);
poptParseArgvString(buildCmd, &argc, &argv);
(void) poptParseArgvString(buildCmd, &argc, &argv);
rpmMessage(RPMMESS_NORMAL, _("Executing(%s): %s\n"), name, buildCmd);
if (!(child = fork())) {
errno = 0;
execvp(argv[0], (char *const *)argv);
(void) execvp(argv[0], (char *const *)argv);
rpmError(RPMERR_SCRIPT, _("Exec of %s failed (%s): %s\n"),
scriptName, name, strerror(errno));
@ -217,10 +218,10 @@ fprintf(stderr, "*** addMacros\n");
exit:
if (scriptName) {
if (!rc)
Unlink(scriptName);
(void) Unlink(scriptName);
scriptName = _free(scriptName);
}
if (u) {
if (u != NULL) {
switch (u->urltype) {
case URL_IS_FTP:
case URL_IS_HTTP:
@ -303,7 +304,7 @@ int buildSpec(Spec spec, int what, int test)
doRmSource(spec);
if (what & RPMBUILD_RMSPEC)
Unlink(spec->specFile);
(void) Unlink(spec->specFile);
exit:
if (rc && rpmlogGetNrecs() > 0) {

View File

@ -645,7 +645,7 @@ int parseExpressionBoolean(Spec spec, const char *expr)
state.spec = spec;
state.nextToken = 0;
state.tokenValue = NULL;
rdToken(&state);
(void) rdToken(&state);
/* Parse the expression. */
v = doLogical(&state);
@ -692,7 +692,7 @@ char * parseExpressionString(Spec spec, const char *expr)
state.spec = spec;
state.nextToken = 0;
state.tokenValue = NULL;
rdToken(&state);
(void) rdToken(&state);
/* Parse the expression. */
v = doLogical(&state);

View File

@ -247,8 +247,8 @@ static void timeCheck(int tc, Header h)
int count, x;
time_t currentTime = time(NULL);
hge(h, RPMTAG_OLDFILENAMES, &fnt, (void **) &files, &count);
hge(h, RPMTAG_FILEMTIMES, NULL, (void **) &mtime, NULL);
(void) hge(h, RPMTAG_OLDFILENAMES, &fnt, (void **) &files, &count);
(void) hge(h, RPMTAG_FILEMTIMES, NULL, (void **) &mtime, NULL);
for (x = 0; x < count; x++) {
if ((currentTime - mtime[x]) > tc)
@ -331,13 +331,13 @@ static int parseForVerify(char *buf, FileList fl)
not = 0;
verifyFlags = RPMVERIFY_NONE;
for (p = q; *p; p = pe) {
for (p = q; *p != '\0'; p = pe) {
SKIPWHITE(p);
if (*p == '\0')
break;
pe = p;
SKIPNONWHITE(pe);
if (*pe)
if (*pe != '\0')
*pe++ = '\0';
{ VFA_t *vfa;
@ -409,7 +409,7 @@ static int parseForAttr(char *buf, FileList fl)
q = pe;
q++;
SKIPSPACE(q);
if (*q) {
if (*q != '\0') {
rpmError(RPMERR_BADSPEC,
_("Non-white space follows %s(): %s\n"), name, q);
fl->processingFailed = 1;
@ -427,23 +427,23 @@ static int parseForAttr(char *buf, FileList fl)
nullAttrRec(ar);
p = q; SKIPWHITE(p);
if (*p) {
pe = p; SKIPNONWHITE(pe); if (*pe) *pe++ = '\0';
if (*p != '\0') {
pe = p; SKIPNONWHITE(pe); if (*pe != '\0') *pe++ = '\0';
ar->ar_fmodestr = p;
p = pe; SKIPWHITE(p);
}
if (*p) {
pe = p; SKIPNONWHITE(pe); if (*pe) *pe++ = '\0';
if (*p != '\0') {
pe = p; SKIPNONWHITE(pe); if (*pe != '\0') *pe++ = '\0';
ar->ar_user = p;
p = pe; SKIPWHITE(p);
}
if (*p) {
pe = p; SKIPNONWHITE(pe); if (*pe) *pe++ = '\0';
if (*p != '\0') {
pe = p; SKIPNONWHITE(pe); if (*pe != '\0') *pe++ = '\0';
ar->ar_group = p;
p = pe; SKIPWHITE(p);
}
if (*p && ret_ar == &(fl->def_ar)) { /* %defattr */
pe = p; SKIPNONWHITE(pe); if (*pe) *pe++ = '\0';
if (*p != '\0' && ret_ar == &(fl->def_ar)) { /* %defattr */
pe = p; SKIPNONWHITE(pe); if (*pe != '\0') *pe++ = '\0';
ar->ar_dmodestr = p;
p = pe; SKIPWHITE(p);
}
@ -530,13 +530,13 @@ static int parseForConfig(char *buf, FileList fl)
while (p <= pe)
*p++ = ' ';
for (p = q; *p; p = pe) {
for (p = q; *p != '\0'; p = pe) {
SKIPWHITE(p);
if (*p == '\0')
break;
pe = p;
SKIPNONWHITE(pe);
if (*pe)
if (*pe != '\0')
*pe++ = '\0';
if (!strcmp(p, "missingok")) {
fl->currentFlags |= RPMFILE_MISSINGOK;
@ -597,7 +597,7 @@ static int parseForLang(char *buf, FileList fl)
*p++ = ' ';
/* Parse multiple arguments from %lang */
for (p = q; *p; p = pe) {
for (p = q; *p != '\0'; p = pe) {
char *newp;
size_t np;
int i;
@ -828,7 +828,7 @@ static int parseForSimple(/*@unused@*/Spec spec, Package pkg, char *buf,
/* XXX WATCHOUT: buf is an arg */
{ const char *ddir, *n, *v;
headerNVR(pkg->header, &n, &v, NULL);
(void) headerNVR(pkg->header, &n, &v, NULL);
ddir = rpmGetPath("%{_docdir}/", n, "-", v, NULL);
strcpy(buf, ddir);
@ -1058,65 +1058,65 @@ static void genCpioListAndHeader(/*@partial@*/ FileList fl,
* compressed file list write before we write the actual package to
* disk.
*/
headerAddOrAppendEntry(h, RPMTAG_OLDFILENAMES, RPM_STRING_ARRAY_TYPE,
(void) headerAddOrAppendEntry(h, RPMTAG_OLDFILENAMES, RPM_STRING_ARRAY_TYPE,
&(flp->fileURL), 1);
if (sizeof(flp->fl_size) != sizeof(uint_32)) {
uint_32 psize = (uint_32)flp->fl_size;
headerAddOrAppendEntry(h, RPMTAG_FILESIZES, RPM_INT32_TYPE,
(void) headerAddOrAppendEntry(h, RPMTAG_FILESIZES, RPM_INT32_TYPE,
&(psize), 1);
} else {
headerAddOrAppendEntry(h, RPMTAG_FILESIZES, RPM_INT32_TYPE,
(void) headerAddOrAppendEntry(h, RPMTAG_FILESIZES, RPM_INT32_TYPE,
&(flp->fl_size), 1);
}
headerAddOrAppendEntry(h, RPMTAG_FILEUSERNAME, RPM_STRING_ARRAY_TYPE,
(void) headerAddOrAppendEntry(h, RPMTAG_FILEUSERNAME, RPM_STRING_ARRAY_TYPE,
&(flp->uname), 1);
headerAddOrAppendEntry(h, RPMTAG_FILEGROUPNAME, RPM_STRING_ARRAY_TYPE,
(void) headerAddOrAppendEntry(h, RPMTAG_FILEGROUPNAME, RPM_STRING_ARRAY_TYPE,
&(flp->gname), 1);
headerAddOrAppendEntry(h, RPMTAG_FILEMTIMES, RPM_INT32_TYPE,
(void) headerAddOrAppendEntry(h, RPMTAG_FILEMTIMES, RPM_INT32_TYPE,
&(flp->fl_mtime), 1);
if (sizeof(flp->fl_mode) != sizeof(uint_16)) {
uint_16 pmode = (uint_16)flp->fl_mode;
headerAddOrAppendEntry(h, RPMTAG_FILEMODES, RPM_INT16_TYPE,
(void) headerAddOrAppendEntry(h, RPMTAG_FILEMODES, RPM_INT16_TYPE,
&(pmode), 1);
} else {
headerAddOrAppendEntry(h, RPMTAG_FILEMODES, RPM_INT16_TYPE,
(void) headerAddOrAppendEntry(h, RPMTAG_FILEMODES, RPM_INT16_TYPE,
&(flp->fl_mode), 1);
}
if (sizeof(flp->fl_rdev) != sizeof(uint_16)) {
uint_16 prdev = (uint_16)flp->fl_rdev;
headerAddOrAppendEntry(h, RPMTAG_FILERDEVS, RPM_INT16_TYPE,
(void) headerAddOrAppendEntry(h, RPMTAG_FILERDEVS, RPM_INT16_TYPE,
&(prdev), 1);
} else {
headerAddOrAppendEntry(h, RPMTAG_FILERDEVS, RPM_INT16_TYPE,
(void) headerAddOrAppendEntry(h, RPMTAG_FILERDEVS, RPM_INT16_TYPE,
&(flp->fl_rdev), 1);
}
if (sizeof(flp->fl_dev) != sizeof(uint_32)) {
uint_32 pdevice = (uint_32)flp->fl_dev;
headerAddOrAppendEntry(h, RPMTAG_FILEDEVICES, RPM_INT32_TYPE,
(void) headerAddOrAppendEntry(h, RPMTAG_FILEDEVICES, RPM_INT32_TYPE,
&(pdevice), 1);
} else {
headerAddOrAppendEntry(h, RPMTAG_FILEDEVICES, RPM_INT32_TYPE,
(void) headerAddOrAppendEntry(h, RPMTAG_FILEDEVICES, RPM_INT32_TYPE,
&(flp->fl_dev), 1);
}
headerAddOrAppendEntry(h, RPMTAG_FILEINODES, RPM_INT32_TYPE,
(void) headerAddOrAppendEntry(h, RPMTAG_FILEINODES, RPM_INT32_TYPE,
&(flp->fl_ino), 1);
headerAddOrAppendEntry(h, RPMTAG_FILELANGS, RPM_STRING_ARRAY_TYPE,
(void) headerAddOrAppendEntry(h, RPMTAG_FILELANGS, RPM_STRING_ARRAY_TYPE,
&(flp->langs), 1);
/* We used to add these, but they should not be needed */
/* headerAddOrAppendEntry(h, RPMTAG_FILEUIDS,
/* (void) headerAddOrAppendEntry(h, RPMTAG_FILEUIDS,
* RPM_INT32_TYPE, &(flp->fl_uid), 1);
* headerAddOrAppendEntry(h, RPMTAG_FILEGIDS,
* (void) headerAddOrAppendEntry(h, RPMTAG_FILEGIDS,
* RPM_INT32_TYPE, &(flp->fl_gid), 1);
*/
buf[0] = '\0';
if (S_ISREG(flp->fl_mode))
mdfile(flp->diskURL, buf);
(void) mdfile(flp->diskURL, buf);
s = buf;
headerAddOrAppendEntry(h, RPMTAG_FILEMD5S, RPM_STRING_ARRAY_TYPE,
(void) headerAddOrAppendEntry(h, RPMTAG_FILEMD5S, RPM_STRING_ARRAY_TYPE,
&s, 1);
buf[0] = '\0';
@ -1136,14 +1136,14 @@ static void genCpioListAndHeader(/*@partial@*/ FileList fl,
}
}
s = buf;
headerAddOrAppendEntry(h, RPMTAG_FILELINKTOS, RPM_STRING_ARRAY_TYPE,
(void) headerAddOrAppendEntry(h, RPMTAG_FILELINKTOS, RPM_STRING_ARRAY_TYPE,
&s, 1);
if (flp->flags & RPMFILE_GHOST) {
flp->verifyFlags &= ~(RPMVERIFY_MD5 | RPMVERIFY_FILESIZE |
RPMVERIFY_LINKTO | RPMVERIFY_MTIME);
}
headerAddOrAppendEntry(h, RPMTAG_FILEVERIFYFLAGS, RPM_INT32_TYPE,
(void) headerAddOrAppendEntry(h, RPMTAG_FILEVERIFYFLAGS, RPM_INT32_TYPE,
&(flp->verifyFlags), 1);
if (!isSrc && isDoc(fl, flp->fileURL))
@ -1152,11 +1152,11 @@ static void genCpioListAndHeader(/*@partial@*/ FileList fl,
if (S_ISDIR(flp->fl_mode))
flp->flags &= ~(RPMFILE_CONFIG|RPMFILE_DOC);
headerAddOrAppendEntry(h, RPMTAG_FILEFLAGS, RPM_INT32_TYPE,
(void) headerAddOrAppendEntry(h, RPMTAG_FILEFLAGS, RPM_INT32_TYPE,
&(flp->flags), 1);
}
headerAddEntry(h, RPMTAG_SIZE, RPM_INT32_TYPE,
(void) headerAddEntry(h, RPMTAG_SIZE, RPM_INT32_TYPE,
&(fl->totalFileSize), 1);
/* XXX This should be added always so that packages look alike.
@ -1164,11 +1164,11 @@ static void genCpioListAndHeader(/*@partial@*/ FileList fl,
* XXX existence (rather than value) that will need to change as well.
*/
if (multiLibMask)
headerAddEntry(h, RPMTAG_MULTILIBS, RPM_INT32_TYPE,
(void) headerAddEntry(h, RPMTAG_MULTILIBS, RPM_INT32_TYPE,
&multiLibMask, 1);
if (_addDotSlash)
rpmlibNeedsFeature(h, "PayloadFilesHavePrefix", "4.0-1");
(void) rpmlibNeedsFeature(h, "PayloadFilesHavePrefix", "4.0-1");
/* Choose how filenames are represented. */
if (_noDirTokens)
@ -1176,7 +1176,7 @@ static void genCpioListAndHeader(/*@partial@*/ FileList fl,
else {
compressFilelist(h);
/* Binary packages with dirNames cannot be installed by legacy rpm. */
rpmlibNeedsFeature(h, "CompressedFileNames", "3.0.4-1");
(void) rpmlibNeedsFeature(h, "CompressedFileNames", "3.0.4-1");
}
{ TFI_t fi = xcalloc(sizeof(*fi), 1);
@ -1336,7 +1336,7 @@ static int addFile(FileList fl, const char * diskURL, struct stat *statp)
fl->inFtw = 1; /* Flag to indicate file has buildRootURL prefixed */
fl->isDir = 1; /* Keep it from following myftw() again */
myftw(diskURL, 16, (myftwFunc) addFile, fl);
(void) myftw(diskURL, 16, (myftwFunc) addFile, fl);
fl->isDir = 0;
fl->inFtw = 0;
return 0;
@ -1379,7 +1379,7 @@ static int addFile(FileList fl, const char * diskURL, struct stat *statp)
#endif
rpmMessage(RPMMESS_DEBUG, _("File %4d: %07o %s.%s\t %s\n"), fl->fileCount,
fileMode, fileUname, fileGname, fileURL);
(unsigned)fileMode, fileUname, fileGname, fileURL);
/* Add to the file list */
if (fl->fileListRecsUsed == fl->fileListRecsAlloced) {
@ -1412,7 +1412,7 @@ static int addFile(FileList fl, const char * diskURL, struct stat *statp)
for (i = 0; i < fl->nLangs; i++) {
const char *ocl;
if (i) *ncl++ = '|';
for (ocl = fl->currentLangs[i]; *ocl; ocl++)
for (ocl = fl->currentLangs[i]; *ocl != '\0'; ocl++)
*ncl++ = *ocl;
*ncl = '\0';
}
@ -1557,7 +1557,7 @@ static int processPackageFiles(Spec spec, Package pkg,
}
appendStringBuf(pkg->fileList, buf);
}
Fclose(fd);
(void) Fclose(fd);
}
/* Init the file list structure */
@ -1632,7 +1632,9 @@ static int processPackageFiles(Spec spec, Package pkg,
if (fl.currentLangs) {
int i;
for (i = 0; i < fl.nLangs; i++)
/*@-unqualifiedtrans@*/
fl.currentLangs[i] = _free(fl.currentLangs[i]);
/*@=unqualifiedtrans@*/
fl.currentLangs = _free(fl.currentLangs);
}
fl.nLangs = 0;
@ -1658,14 +1660,14 @@ static int processPackageFiles(Spec spec, Package pkg,
specialDoc = xstrdup(fileName);
dupAttrRec(&fl.cur_ar, specialDocAttrRec);
} else {
processBinaryFile(pkg, &fl, fileName);
(void) processBinaryFile(pkg, &fl, fileName);
}
}
/* Now process special doc, if there is one */
if (specialDoc) {
if (installSpecialDoc) {
doScript(spec, RPMBUILD_STRINGBUF, "%doc", pkg->specialDoc, test);
(void) doScript(spec, RPMBUILD_STRINGBUF, "%doc", pkg->specialDoc, test);
}
/* Reset for %doc */
@ -1678,7 +1680,9 @@ static int processPackageFiles(Spec spec, Package pkg,
if (fl.currentLangs) {
int i;
for (i = 0; i < fl.nLangs; i++)
/*@-unqualifiedtrans@*/
fl.currentLangs[i] = _free(fl.currentLangs[i]);
/*@=unqualifiedtrans@*/
fl.currentLangs = _free(fl.currentLangs);
}
fl.nLangs = 0;
@ -1686,7 +1690,7 @@ static int processPackageFiles(Spec spec, Package pkg,
dupAttrRec(specialDocAttrRec, &fl.cur_ar);
freeAttrRec(specialDocAttrRec);
processBinaryFile(pkg, &fl, specialDoc);
(void) processBinaryFile(pkg, &fl, specialDoc);
specialDoc = _free(specialDoc);
}
@ -1714,7 +1718,9 @@ exit:
if (fl.currentLangs) {
int i;
for (i = 0; i < fl.nLangs; i++)
/*@-unqualifiedtrans@*/
fl.currentLangs[i] = _free(fl.currentLangs[i]);
/*@=unqualifiedtrans@*/
fl.currentLangs = _free(fl.currentLangs);
}
@ -1756,7 +1762,7 @@ void initSourceHeader(Spec spec)
case RPMTAG_CHANGELOGTEXT:
case RPMTAG_URL:
case HEADER_I18NTABLE:
headerAddEntry(spec->sourceHeader, tag, type, ptr, count);
(void) headerAddEntry(spec->sourceHeader, tag, type, ptr, count);
break;
default:
/* do not copy */
@ -1770,12 +1776,12 @@ void initSourceHeader(Spec spec)
headerNextIterator(hi, &tag, &type, &ptr, &count);
ptr = headerFreeData(ptr, type))
{
headerAddEntry(spec->sourceHeader, tag, type, ptr, count);
(void) headerAddEntry(spec->sourceHeader, tag, type, ptr, count);
}
headerFreeIterator(hi);
if (spec->buildArchitectureCount) {
headerAddEntry(spec->sourceHeader, RPMTAG_BUILDARCHS,
(void) headerAddEntry(spec->sourceHeader, RPMTAG_BUILDARCHS,
RPM_STRING_ARRAY_TYPE,
spec->buildArchitectures, spec->buildArchitectureCount);
}
@ -1803,18 +1809,18 @@ int processSourceFiles(Spec spec)
appendLineStringBuf(sourceFiles, spec->specFile);
for (srcPtr = spec->sources; srcPtr != NULL; srcPtr = srcPtr->next) {
if (srcPtr->flags & RPMBUILD_ISSOURCE) {
headerAddOrAppendEntry(spec->sourceHeader, RPMTAG_SOURCE,
(void) headerAddOrAppendEntry(spec->sourceHeader, RPMTAG_SOURCE,
RPM_STRING_ARRAY_TYPE, &srcPtr->source, 1);
if (srcPtr->flags & RPMBUILD_ISNO) {
headerAddOrAppendEntry(spec->sourceHeader, RPMTAG_NOSOURCE,
(void) headerAddOrAppendEntry(spec->sourceHeader, RPMTAG_NOSOURCE,
RPM_INT32_TYPE, &srcPtr->num, 1);
}
}
if (srcPtr->flags & RPMBUILD_ISPATCH) {
headerAddOrAppendEntry(spec->sourceHeader, RPMTAG_PATCH,
(void) headerAddOrAppendEntry(spec->sourceHeader, RPMTAG_PATCH,
RPM_STRING_ARRAY_TYPE, &srcPtr->source, 1);
if (srcPtr->flags & RPMBUILD_ISNO) {
headerAddOrAppendEntry(spec->sourceHeader, RPMTAG_NOPATCH,
(void) headerAddOrAppendEntry(spec->sourceHeader, RPMTAG_NOPATCH,
RPM_INT32_TYPE, &srcPtr->num, 1);
}
}
@ -1929,25 +1935,25 @@ static StringBuf getOutputFrom(char *dir, char *argv[],
oldhandler = signal(SIGPIPE, SIG_IGN);
toProg[0] = toProg[1] = 0;
pipe(toProg);
(void) pipe(toProg);
fromProg[0] = fromProg[1] = 0;
pipe(fromProg);
(void) pipe(fromProg);
if (!(progPID = fork())) {
close(toProg[1]);
close(fromProg[0]);
(void) close(toProg[1]);
(void) close(fromProg[0]);
dup2(toProg[0], STDIN_FILENO); /* Make stdin the in pipe */
dup2(fromProg[1], STDOUT_FILENO); /* Make stdout the out pipe */
(void) dup2(toProg[0], STDIN_FILENO); /* Make stdin the in pipe */
(void) dup2(fromProg[1], STDOUT_FILENO); /* Make stdout the out pipe */
close(toProg[0]);
close(fromProg[1]);
(void) close(toProg[0]);
(void) close(fromProg[1]);
if (dir) {
chdir(dir);
(void) chdir(dir);
}
execvp(argv[0], argv);
(void) execvp(argv[0], argv);
/* XXX this error message is probably not seen. */
rpmError(RPMERR_EXEC, _("Couldn't exec %s: %s\n"),
argv[0], strerror(errno));
@ -1959,12 +1965,12 @@ static StringBuf getOutputFrom(char *dir, char *argv[],
return NULL;
}
close(toProg[0]);
close(fromProg[1]);
(void) close(toProg[0]);
(void) close(fromProg[1]);
/* Do not block reading or writing from/to prog. */
fcntl(fromProg[0], F_SETFL, O_NONBLOCK);
fcntl(toProg[1], F_SETFL, O_NONBLOCK);
(void) fcntl(fromProg[0], F_SETFL, O_NONBLOCK);
(void) fcntl(toProg[1], F_SETFL, O_NONBLOCK);
readBuff = newStringBuf();
@ -2008,7 +2014,7 @@ top:
writeBytesLeft -= nbw;
writePtr += nbw;
} else if (toProg[1] >= 0) { /* close write fd */
close(toProg[1]);
(void) close(toProg[1]);
toProg[1] = -1;
}
}
@ -2028,10 +2034,10 @@ top:
/* Clean up */
if (toProg[1] >= 0)
close(toProg[1]);
(void) close(toProg[1]);
if (fromProg[0] >= 0)
close(fromProg[0]);
(void)signal(SIGPIPE, oldhandler);
(void) close(fromProg[0]);
(void) signal(SIGPIPE, oldhandler);
/* Collect status from prog */
(void)waitpid(progPID, &status, 0);
@ -2290,7 +2296,7 @@ static void printDeps(Header h)
break;
default:
versions = hfd(versions, dvt);
hge(h, dm->vtag, &dvt, (void **) &versions, NULL);
(void) hge(h, dm->vtag, &dvt, (void **) &versions, NULL);
break;
}
switch (dm->ftag) {
@ -2300,7 +2306,7 @@ static void printDeps(Header h)
case -1:
break;
default:
hge(h, dm->ftag, NULL, (void **) &flags, NULL);
(void) hge(h, dm->ftag, NULL, (void **) &flags, NULL);
break;
}
printDepMsg(dm, count, names, versions, flags);
@ -2321,7 +2327,7 @@ int processBinaryFiles(Spec spec, int installSpecialDoc, int test)
if (pkg->fileList == NULL)
continue;
headerNVR(pkg->header, &n, &v, &r);
(void) headerNVR(pkg->header, &n, &v, &r);
rpmMessage(RPMMESS_NORMAL, _("Processing files: %s-%s-%s\n"), n, v, r);
if ((rc = processPackageFiles(spec, pkg, installSpecialDoc, test)))
@ -2332,10 +2338,10 @@ int processBinaryFiles(Spec spec, int installSpecialDoc, int test)
* XXX existence (rather than value) that will need to change as well.
*/
if (headerIsEntry(pkg->header, RPMTAG_MULTILIBS)) {
generateDepends(spec, pkg, pkg->cpioList, 1);
generateDepends(spec, pkg, pkg->cpioList, 2);
(void) generateDepends(spec, pkg, pkg->cpioList, 1);
(void) generateDepends(spec, pkg, pkg->cpioList, 2);
} else
generateDepends(spec, pkg, pkg->cpioList, 0);
(void) generateDepends(spec, pkg, pkg->cpioList, 0);
printDeps(pkg->header);
}

View File

@ -107,7 +107,7 @@ myftw_dir (DIR **dirs, int level, int descriptors,
newlev = (level + 1) % descriptors;
if (dirs[newlev] != NULL)
Closedir (dirs[newlev]);
(void) Closedir (dirs[newlev]);
dirs[newlev] = Opendir (dir);
if (dirs[newlev] != NULL)
@ -134,7 +134,7 @@ myftw_dir (DIR **dirs, int level, int descriptors,
int save;
save = errno;
Closedir (dirs[newlev]);
(void) Closedir (dirs[newlev]);
errno = save;
dirs[newlev] = NULL;
}
@ -228,7 +228,7 @@ int myftw (const char *dir,
int save;
save = errno;
Closedir (dirs[0]);
(void) Closedir (dirs[0]);
errno = save;
}
}

View File

@ -126,7 +126,7 @@ const char *const buildHost(void)
struct hostent *hbn;
if (! gotit) {
gethostname(hostname, sizeof(hostname));
(void) gethostname(hostname, sizeof(hostname));
if ((hbn = /*@-unrecog@*/ gethostbyname(hostname) /*@=unrecog@*/ ))
strcpy(hostname, hbn->h_name);
else

View File

@ -29,7 +29,7 @@ static inline int genSourceRpmName(Spec spec)
const char *name, *version, *release;
char fileName[BUFSIZ];
headerNVR(spec->packages->header, &name, &version, &release);
(void) headerNVR(spec->packages->header, &name, &version, &release);
sprintf(fileName, "%s-%s-%s.%ssrc.rpm", name, version, release,
spec->noSource ? "no" : "");
spec->sourceRpmName = xstrdup(fileName);
@ -60,7 +60,7 @@ static int cpio_doio(FD_t fdo, /*@unused@*/ Header h, CSA_t * csa,
rc = fsmSetup(fi->fsm, FSM_PKGBUILD, ts, fi, cfd,
&csa->cpioArchiveSize, &failedFile);
Fclose(cfd);
(void) Fclose(cfd);
(void) fsmTeardown(fi->fsm);
if (rc) {
@ -101,10 +101,12 @@ static int cpio_copy(FD_t fdo, CSA_t *csa)
/**
*/
static StringBuf addFileToTagAux(Spec spec, const char *file, StringBuf sb)
static /*@only@*/ /*@null@*/ StringBuf addFileToTagAux(Spec spec,
const char * file, /*@only@*/ StringBuf sb)
{
char buf[BUFSIZ];
const char *fn = buf;
const char * fn = buf;
FILE * f;
FD_t fd;
/* XXX use rpmGenPath(rootdir, "%{_buildir}/%{_buildsubdir}/", file) */
@ -116,15 +118,18 @@ static StringBuf addFileToTagAux(Spec spec, const char *file, StringBuf sb)
freeStringBuf(sb);
return NULL;
}
while (fgets(buf, sizeof(buf), (FILE *)fdGetFp(fd))) {
f = fdGetFp(fd);
while (fgets(buf, sizeof(buf), f)) {
/* XXX display fn in error msg */
if (expandMacros(spec, spec->macros, buf, sizeof(buf))) {
rpmError(RPMERR_BADSPEC, _("line: %s\n"), buf);
return NULL;
freeStringBuf(sb);
sb = NULL;
break;
}
appendStringBuf(sb, buf);
}
Fclose(fd);
(void) Fclose(fd);
return sb;
}
@ -139,13 +144,13 @@ static int addFileToTag(Spec spec, const char * file, Header h, int tag)
if (hge(h, tag, NULL, (void **)&s, NULL)) {
appendLineStringBuf(sb, s);
headerRemoveEntry(h, tag);
(void) headerRemoveEntry(h, tag);
}
if ((sb = addFileToTagAux(spec, file, sb)) == NULL)
return 1;
headerAddEntry(h, tag, RPM_STRING_TYPE, getStringBuf(sb), 1);
(void) headerAddEntry(h, tag, RPM_STRING_TYPE, getStringBuf(sb), 1);
freeStringBuf(sb);
return 0;
@ -162,7 +167,7 @@ static int addFileToArrayTag(Spec spec, const char *file, Header h, int tag)
return 1;
s = getStringBuf(sb);
headerAddOrAppendEntry(h, tag, RPM_STRING_ARRAY_TYPE, &s, 1);
(void) headerAddOrAppendEntry(h, tag, RPM_STRING_ARRAY_TYPE, &s, 1);
freeStringBuf(sb);
return 0;
@ -212,10 +217,10 @@ static int processScriptFiles(Spec spec, Package pkg)
}
for (p = pkg->triggerFiles; p != NULL; p = p->next) {
headerAddOrAppendEntry(pkg->header, RPMTAG_TRIGGERSCRIPTPROG,
(void) headerAddOrAppendEntry(pkg->header, RPMTAG_TRIGGERSCRIPTPROG,
RPM_STRING_ARRAY_TYPE, &(p->prog), 1);
if (p->script) {
headerAddOrAppendEntry(pkg->header, RPMTAG_TRIGGERSCRIPTS,
(void) headerAddOrAppendEntry(pkg->header, RPMTAG_TRIGGERSCRIPTS,
RPM_STRING_ARRAY_TYPE, &(p->script), 1);
} else if (p->fileName) {
if (addFileToArrayTag(spec, p->fileName, pkg->header,
@ -229,7 +234,7 @@ static int processScriptFiles(Spec spec, Package pkg)
/* This is dumb. When the header supports NULL string */
/* this will go away. */
char *bull = "";
headerAddOrAppendEntry(pkg->header, RPMTAG_TRIGGERSCRIPTS,
(void) headerAddOrAppendEntry(pkg->header, RPMTAG_TRIGGERSCRIPTS,
RPM_STRING_ARRAY_TYPE, &bull, 1);
}
}
@ -301,7 +306,7 @@ int readRPM(const char *fileName, Spec *specp, struct rpmlead *lead, Header *sig
if (csa)
csa->cpioFdIn = fdi;
else
Fclose(fdi);
(void) Fclose(fdi);
return 0;
}
@ -322,7 +327,7 @@ int writeRPM(Header *hdrp, const char *fileName, int type,
if (Fileno(csa->cpioFdIn) < 0) {
csa->cpioArchiveSize = 0;
/* Add a bogus archive size to the Header */
headerAddEntry(h, RPMTAG_ARCHIVESIZE, RPM_INT32_TYPE,
(void) headerAddEntry(h, RPMTAG_ARCHIVESIZE, RPM_INT32_TYPE,
&csa->cpioArchiveSize, 1);
}
@ -357,26 +362,26 @@ int writeRPM(Header *hdrp, const char *fileName, int type,
}
s = strchr(rpmio_flags, '.');
if (s) {
headerAddEntry(h, RPMTAG_PAYLOADFORMAT, RPM_STRING_TYPE, "cpio", 1);
(void) headerAddEntry(h, RPMTAG_PAYLOADFORMAT, RPM_STRING_TYPE, "cpio", 1);
if (s[1] == 'g' && s[2] == 'z')
headerAddEntry(h, RPMTAG_PAYLOADCOMPRESSOR, RPM_STRING_TYPE,
(void) headerAddEntry(h, RPMTAG_PAYLOADCOMPRESSOR, RPM_STRING_TYPE,
"gzip", 1);
if (s[1] == 'b' && s[2] == 'z') {
headerAddEntry(h, RPMTAG_PAYLOADCOMPRESSOR, RPM_STRING_TYPE,
(void) headerAddEntry(h, RPMTAG_PAYLOADCOMPRESSOR, RPM_STRING_TYPE,
"bzip2", 1);
/* Add prereq on rpm version that understands bzip2 payloads */
rpmlibNeedsFeature(h, "PayloadIsBzip2", "3.0.5-1");
(void) rpmlibNeedsFeature(h, "PayloadIsBzip2", "3.0.5-1");
}
strcpy(buf, rpmio_flags);
buf[s - rpmio_flags] = '\0';
headerAddEntry(h, RPMTAG_PAYLOADFLAGS, RPM_STRING_TYPE, buf+1, 1);
(void) headerAddEntry(h, RPMTAG_PAYLOADFLAGS, RPM_STRING_TYPE, buf+1, 1);
}
/* Create and add the cookie */
if (cookie) {
sprintf(buf, "%s %d", buildHost(), (int) time(NULL));
*cookie = xstrdup(buf);
headerAddEntry(h, RPMTAG_COOKIE, RPM_STRING_TYPE, *cookie, 1);
(void) headerAddEntry(h, RPMTAG_COOKIE, RPM_STRING_TYPE, *cookie, 1);
}
/* Reallocate the header into one contiguous region. */
@ -428,21 +433,21 @@ int writeRPM(Header *hdrp, const char *fileName, int type,
if (headerWrite(fd, h, HEADER_MAGIC_YES))
rc = RPMERR_NOSPACE;
Fclose(fd);
(void) Fclose(fd);
fd = NULL;
Unlink(fileName);
(void) Unlink(fileName);
if (rc)
goto exit;
/* Generate the signature */
fflush(stdout);
(void) fflush(stdout);
sig = rpmNewSignature();
rpmAddSignature(sig, sigtarget, RPMSIGTAG_SIZE, passPhrase);
rpmAddSignature(sig, sigtarget, RPMSIGTAG_MD5, passPhrase);
(void) rpmAddSignature(sig, sigtarget, RPMSIGTAG_SIZE, passPhrase);
(void) rpmAddSignature(sig, sigtarget, RPMSIGTAG_MD5, passPhrase);
if ((sigtype = rpmLookupSignatureType(RPMLOOKUPSIG_QUERY)) > 0) {
rpmMessage(RPMMESS_NORMAL, _("Generating signature: %d\n"), sigtype);
rpmAddSignature(sig, sigtarget, sigtype, passPhrase);
(void) rpmAddSignature(sig, sigtarget, sigtype, passPhrase);
}
/* Reallocate the signature into one contiguous region. */
@ -482,7 +487,7 @@ int writeRPM(Header *hdrp, const char *fileName, int type,
lead.signature_type = RPMSIGTYPE_HEADERSIG;
{ const char *name, *version, *release;
headerNVR(h, &name, &version, &release);
(void) headerNVR(h, &name, &version, &release);
sprintf(buf, "%s-%s-%s", name, version, release);
strncpy(lead.name, buf, sizeof(lead.name));
}
@ -520,7 +525,7 @@ int writeRPM(Header *hdrp, const char *fileName, int type,
}
#ifdef NOTYET
headerMergeLegacySigs(nh, sig);
(void) headerMergeLegacySigs(nh, sig);
#endif
rc = headerWrite(fd, nh, HEADER_MAGIC_YES);
@ -557,22 +562,22 @@ exit:
sig = NULL;
}
if (ifd) {
Fclose(ifd);
(void) Fclose(ifd);
ifd = NULL;
}
if (fd) {
Fclose(fd);
(void) Fclose(fd);
fd = NULL;
}
if (sigtarget) {
Unlink(sigtarget);
(void) Unlink(sigtarget);
sigtarget = _free(sigtarget);
}
if (rc == 0)
rpmMessage(RPMMESS_NORMAL, _("Wrote: %s\n"), fileName);
else
Unlink(fileName);
(void) Unlink(fileName);
return rc;
}
@ -601,30 +606,30 @@ int packageBinaries(Spec spec)
return rc;
if (spec->cookie) {
headerAddEntry(pkg->header, RPMTAG_COOKIE,
(void) headerAddEntry(pkg->header, RPMTAG_COOKIE,
RPM_STRING_TYPE, spec->cookie, 1);
}
/* Copy changelog from src rpm */
headerCopyTags(spec->packages->header, pkg->header, copyTags);
headerAddEntry(pkg->header, RPMTAG_RPMVERSION,
(void) headerAddEntry(pkg->header, RPMTAG_RPMVERSION,
RPM_STRING_TYPE, VERSION, 1);
headerAddEntry(pkg->header, RPMTAG_BUILDHOST,
(void) headerAddEntry(pkg->header, RPMTAG_BUILDHOST,
RPM_STRING_TYPE, buildHost(), 1);
headerAddEntry(pkg->header, RPMTAG_BUILDTIME,
(void) headerAddEntry(pkg->header, RPMTAG_BUILDTIME,
RPM_INT32_TYPE, getBuildTime(), 1);
providePackageNVR(pkg->header);
{ const char * optflags = rpmExpand("%{optflags}", NULL);
headerAddEntry(pkg->header, RPMTAG_OPTFLAGS, RPM_STRING_TYPE,
(void) headerAddEntry(pkg->header, RPMTAG_OPTFLAGS, RPM_STRING_TYPE,
optflags, 1);
optflags = _free(optflags);
}
genSourceRpmName(spec);
headerAddEntry(pkg->header, RPMTAG_SOURCERPM, RPM_STRING_TYPE,
(void) genSourceRpmName(spec);
(void) headerAddEntry(pkg->header, RPMTAG_SOURCERPM, RPM_STRING_TYPE,
spec->sourceRpmName, 1);
{ const char *binFormat = rpmGetPath("%{_rpmfilename}", NULL);
@ -634,7 +639,7 @@ int packageBinaries(Spec spec)
binFormat = _free(binFormat);
if (binRpm == NULL) {
const char *name;
headerNVR(pkg->header, &name, NULL, NULL);
(void) headerNVR(pkg->header, &name, NULL, NULL);
rpmError(RPMERR_BADFILENAME, _("Could not generate output "
"filename for package %s: %s\n"), name, errorString);
return RPMERR_BADFILENAME;
@ -684,14 +689,14 @@ int packageSources(Spec spec)
int rc;
/* Add some cruft */
headerAddEntry(spec->sourceHeader, RPMTAG_RPMVERSION,
(void) headerAddEntry(spec->sourceHeader, RPMTAG_RPMVERSION,
RPM_STRING_TYPE, VERSION, 1);
headerAddEntry(spec->sourceHeader, RPMTAG_BUILDHOST,
(void) headerAddEntry(spec->sourceHeader, RPMTAG_BUILDHOST,
RPM_STRING_TYPE, buildHost(), 1);
headerAddEntry(spec->sourceHeader, RPMTAG_BUILDTIME,
(void) headerAddEntry(spec->sourceHeader, RPMTAG_BUILDTIME,
RPM_INT32_TYPE, getBuildTime(), 1);
genSourceRpmName(spec);
(void) genSourceRpmName(spec);
spec->cookie = _free(spec->cookie);

View File

@ -12,18 +12,18 @@ void addChangelogEntry(Header h, time_t time, const char *name, const char *text
{
int_32 mytime = time; /* XXX convert to header representation */
if (headerIsEntry(h, RPMTAG_CHANGELOGTIME)) {
headerAppendEntry(h, RPMTAG_CHANGELOGTIME, RPM_INT32_TYPE,
(void) headerAppendEntry(h, RPMTAG_CHANGELOGTIME, RPM_INT32_TYPE,
&mytime, 1);
headerAppendEntry(h, RPMTAG_CHANGELOGNAME, RPM_STRING_ARRAY_TYPE,
(void) headerAppendEntry(h, RPMTAG_CHANGELOGNAME, RPM_STRING_ARRAY_TYPE,
&name, 1);
headerAppendEntry(h, RPMTAG_CHANGELOGTEXT, RPM_STRING_ARRAY_TYPE,
(void) headerAppendEntry(h, RPMTAG_CHANGELOGTEXT, RPM_STRING_ARRAY_TYPE,
&text, 1);
} else {
headerAddEntry(h, RPMTAG_CHANGELOGTIME, RPM_INT32_TYPE,
(void) headerAddEntry(h, RPMTAG_CHANGELOGTIME, RPM_INT32_TYPE,
&mytime, 1);
headerAddEntry(h, RPMTAG_CHANGELOGNAME, RPM_STRING_ARRAY_TYPE,
(void) headerAddEntry(h, RPMTAG_CHANGELOGNAME, RPM_STRING_ARRAY_TYPE,
&name, 1);
headerAddEntry(h, RPMTAG_CHANGELOGTEXT, RPM_STRING_ARRAY_TYPE,
(void) headerAddEntry(h, RPMTAG_CHANGELOGTEXT, RPM_STRING_ARRAY_TYPE,
&text, 1);
}
}
@ -52,7 +52,7 @@ static int dateToTimet(const char * datestr, /*@out@*/ time_t * secs)
/* day of week */
p = pe; SKIPSPACE(p);
if (*p == '\0') return -1;
pe = p; SKIPNONSPACE(pe); if (*pe) *pe++ = '\0';
pe = p; SKIPNONSPACE(pe); if (*pe != '\0') *pe++ = '\0';
for (idx = days; *idx && strcmp(*idx, p); idx++)
;
if (*idx == NULL) return -1;
@ -60,7 +60,7 @@ static int dateToTimet(const char * datestr, /*@out@*/ time_t * secs)
/* month */
p = pe; SKIPSPACE(p);
if (*p == '\0') return -1;
pe = p; SKIPNONSPACE(pe); if (*pe) *pe++ = '\0';
pe = p; SKIPNONSPACE(pe); if (*pe != '\0') *pe++ = '\0';
for (idx = months; *idx && strcmp(*idx, p); idx++)
;
if (*idx == NULL) return -1;
@ -69,7 +69,7 @@ static int dateToTimet(const char * datestr, /*@out@*/ time_t * secs)
/* day */
p = pe; SKIPSPACE(p);
if (*p == '\0') return -1;
pe = p; SKIPNONSPACE(pe); if (*pe) *pe++ = '\0';
pe = p; SKIPNONSPACE(pe); if (*pe != '\0') *pe++ = '\0';
/* make this noon so the day is always right (as we make this UTC) */
time.tm_hour = 12;
@ -81,7 +81,7 @@ static int dateToTimet(const char * datestr, /*@out@*/ time_t * secs)
/* year */
p = pe; SKIPSPACE(p);
if (*p == '\0') return -1;
pe = p; SKIPNONSPACE(pe); if (*pe) *pe++ = '\0';
pe = p; SKIPNONSPACE(pe); if (*pe != '\0') *pe++ = '\0';
time.tm_year = strtol(p, &q, 10);
if (!(q && *q == '\0')) return -1;
if (time.tm_year < 1997 || time.tm_year >= 3000) return -1;
@ -115,7 +115,7 @@ static int addChangelog(Header h, StringBuf sb)
/* skip space */
SKIPSPACE(s);
while (*s) {
while (*s != '\0') {
if (*s != '*') {
rpmError(RPMERR_BADSPEC,
_("%%changelog entries must start with *\n"));
@ -129,7 +129,9 @@ static int addChangelog(Header h, StringBuf sb)
rpmError(RPMERR_BADSPEC, _("incomplete %%changelog entry\n"));
return RPMERR_BADSPEC;
}
/*@-modobserver@*/
*s = '\0';
/*@=modobserver@*/
text = s + 1;
/* 4 fields of date */
@ -160,7 +162,7 @@ static int addChangelog(Header h, StringBuf sb)
/* name */
name = s;
while (*s) s++;
while (*s != '\0') s++;
while (s > name && xisspace(*s)) {
*s-- = '\0';
}

View File

@ -118,7 +118,7 @@ int parseDescription(Spec spec)
stripTrailingBlanksStringBuf(sb);
if (!(noLang && strcmp(lang, RPMBUILD_DEFAULT_LANG))) {
headerAddI18NString(pkg->header, RPMTAG_DESCRIPTION,
(void) headerAddI18NString(pkg->header, RPMTAG_DESCRIPTION,
getStringBuf(sb), lang);
}

View File

@ -50,9 +50,9 @@ static void addOrAppendListEntry(Header h, int_32 tag, char *line)
int argc;
const char **argv;
poptParseArgvString(line, &argc, &argv);
(void) poptParseArgvString(line, &argc, &argv);
if (argc)
headerAddOrAppendEntry(h, tag, RPM_STRING_ARRAY_TYPE, argv, argc);
(void) headerAddOrAppendEntry(h, tag, RPM_STRING_ARRAY_TYPE, argv, argc);
argv = _free(argv);
}
@ -139,7 +139,7 @@ static int parseBits(const char * s, const tokenBits tokbits,
int c = 0;
if (s) {
while (*s) {
while (*s != '\0') {
while ((c = *s) && xisspace(c)) s++;
se = s;
while ((c = *se) && xisalpha(c)) se++;
@ -158,7 +158,7 @@ static int parseBits(const char * s, const tokenBits tokbits,
s = ++se;
}
}
if (c == 0 && *bp) *bp = bits;
if (c == 0 && bp) *bp = bits;
return (c ? RPMERR_BADSPEC : 0);
}
@ -168,13 +168,15 @@ static inline char * findLastChar(char * s)
{
char *res = s;
while (*s) {
while (*s != '\0') {
if (! xisspace(*s))
res = s;
s++;
}
/*@-temptrans@*/
return res;
/*@=temptrans@*/
}
/**
@ -304,7 +306,7 @@ static void fillOutMainPackage(Header h)
if (!headerIsEntry(h, ot->ot_tag)) {
const char *val = rpmExpand(ot->ot_mac, NULL);
if (val && *val != '%')
headerAddEntry(h, ot->ot_tag, RPM_STRING_TYPE, (void *)val, 1);
(void) headerAddEntry(h, ot->ot_tag, RPM_STRING_TYPE, (void *)val, 1);
val = _free(val);
}
}
@ -334,7 +336,7 @@ static int readIcon(Header h, const char *file)
size = fdSize(fd);
iconsize = (size >= 0 ? size : (8 * BUFSIZ));
if (iconsize == 0) {
Fclose(fd);
(void) Fclose(fd);
rc = 0;
goto exit;
}
@ -348,14 +350,14 @@ static int readIcon(Header h, const char *file)
fn, Fstrerror(fd));
rc = RPMERR_BADSPEC;
}
Fclose(fd);
(void) Fclose(fd);
if (rc)
goto exit;
if (! strncmp(icon, "GIF", sizeof("GIF")-1)) {
headerAddEntry(h, RPMTAG_GIF, RPM_BIN_TYPE, icon, iconsize);
(void) headerAddEntry(h, RPMTAG_GIF, RPM_BIN_TYPE, icon, iconsize);
} else if (! strncmp(icon, "/* XPM", sizeof("/* XPM")-1)) {
headerAddEntry(h, RPMTAG_XPM, RPM_BIN_TYPE, icon, iconsize);
(void) headerAddEntry(h, RPMTAG_XPM, RPM_BIN_TYPE, icon, iconsize);
} else {
rpmError(RPMERR_BADSPEC, _("Unknown icon type: %s\n"), file);
rc = RPMERR_BADSPEC;
@ -395,7 +397,9 @@ stashSt(Spec spec, Header h, int tag, const char *lang)
}
}
}
/*@-usereleased -compdef@*/
return t;
/*@=usereleased =compdef@*/
}
#define SINGLE_TOKEN_ONLY \
@ -446,7 +450,7 @@ static int handlePreambleTag(Spec spec, Package pkg, int tag, const char *macro,
/* See if this is multi-token */
end = field;
SKIPNONSPACE(end);
if (*end)
if (*end != '\0')
multiToken = 1;
switch (tag) {
@ -471,7 +475,7 @@ static int handlePreambleTag(Spec spec, Package pkg, int tag, const char *macro,
}
addMacro(spec->macros, "PACKAGE_RELEASE", NULL, field, RMIL_OLDSPEC-1);
}
headerAddEntry(pkg->header, tag, RPM_STRING_TYPE, field, 1);
(void) headerAddEntry(pkg->header, tag, RPM_STRING_TYPE, field, 1);
break;
case RPMTAG_GROUP:
case RPMTAG_SUMMARY:
@ -482,9 +486,9 @@ static int handlePreambleTag(Spec spec, Package pkg, int tag, const char *macro,
case RPMTAG_LICENSE:
case RPMTAG_PACKAGER:
if (!*lang)
headerAddEntry(pkg->header, tag, RPM_STRING_TYPE, field, 1);
(void) headerAddEntry(pkg->header, tag, RPM_STRING_TYPE, field, 1);
else if (!(noLang && strcmp(lang, RPMBUILD_DEFAULT_LANG)))
headerAddI18NString(pkg->header, tag, field, lang);
(void) headerAddI18NString(pkg->header, tag, field, lang);
break;
case RPMTAG_BUILDROOT:
SINGLE_TOKEN_ONLY;
@ -530,7 +534,7 @@ static int handlePreambleTag(Spec spec, Package pkg, int tag, const char *macro,
} break;
case RPMTAG_PREFIXES:
addOrAppendListEntry(pkg->header, tag, field);
hge(pkg->header, tag, &type, (void **)&array, &num);
(void) hge(pkg->header, tag, &type, (void **)&array, &num);
while (num--) {
len = strlen(array[num]);
if (array[num][len - 1] == '/' && len > 1) {
@ -563,7 +567,7 @@ static int handlePreambleTag(Spec spec, Package pkg, int tag, const char *macro,
spec->lineNum, spec->line);
return RPMERR_BADSPEC;
}
headerAddEntry(pkg->header, tag, RPM_INT32_TYPE, &num, 1);
(void) headerAddEntry(pkg->header, tag, RPM_INT32_TYPE, &num, 1);
break;
case RPMTAG_AUTOREQPROV:
pkg->autoReq = parseYesNo(field);
@ -768,7 +772,9 @@ static int findPreambleTag(Spec spec, /*@out@*/int *tag, /*@out@*/char **macro,
*tag = p->tag;
if (macro)
/*@-onlytrans@*/
*macro = p->token;
/*@=onlytrans@*/
return 0;
}
@ -803,11 +809,11 @@ int parsePreamble(Spec spec, int initialPackage)
/* Construct the package */
if (flag == PART_SUBNAME) {
const char * mainName;
headerNVR(spec->packages->header, &mainName, NULL, NULL);
(void) headerNVR(spec->packages->header, &mainName, NULL, NULL);
sprintf(fullName, "%s-%s", mainName, name);
} else
strcpy(fullName, name);
headerAddEntry(pkg->header, RPMTAG_NAME, RPM_STRING_TYPE, fullName, 1);
(void) headerAddEntry(pkg->header, RPMTAG_NAME, RPM_STRING_TYPE, fullName, 1);
}
if ((rc = readLine(spec, STRIP_TRAILINGSPACE | STRIP_COMMENTS)) > 0) {
@ -819,7 +825,7 @@ int parsePreamble(Spec spec, int initialPackage)
/* Skip blank lines */
linep = spec->line;
SKIPSPACE(linep);
if (*linep) {
if (*linep != '\0') {
if (findPreambleTag(spec, &tag, &macro, lang)) {
rpmError(RPMERR_BADSPEC, _("line %d: Unknown tag: %s\n"),
spec->lineNum, spec->line);

View File

@ -295,8 +295,8 @@ static int doSetupMacro(Spec spec, char *line)
/* We only parse -a and -b here */
if (parseNum(optArg, &num)) {
rpmError(RPMERR_BADSPEC, _("line %d: Bad arg to %%setup %c: %s\n"),
spec->lineNum, num, optArg);
rpmError(RPMERR_BADSPEC, _("line %d: Bad arg to %%setup: %s\n"),
spec->lineNum, optArg);
freeStringBuf(before);
freeStringBuf(after);
poptFreeContext(optCon);
@ -328,7 +328,7 @@ static int doSetupMacro(Spec spec, char *line)
spec->buildSubdir = xstrdup(dirName);
} else {
const char *name, *version;
headerNVR(spec->packages->header, &name, &version, NULL);
(void) headerNVR(spec->packages->header, &name, &version, NULL);
sprintf(buf, "%s-%s", name, version);
spec->buildSubdir = xstrdup(buf);
}
@ -548,6 +548,7 @@ int parsePrep(Spec spec)
}
saveLines = splitString(getStringBuf(buf), strlen(getStringBuf(buf)), '\n');
/*@-usereleased@*/
for (lines = saveLines; *lines; lines++) {
res = 0;
if (! strncmp(*lines, "%setup", sizeof("%setup")-1)) {
@ -563,6 +564,7 @@ int parsePrep(Spec spec)
return res;
}
}
/*@=usereleased@*/
freeSplitString(saveLines);
freeStringBuf(buf);

View File

@ -87,7 +87,7 @@ int parseRCPOT(Spec spec, Package pkg, const char *field, int tag,
break;
}
for (r = field; *r; r = re) {
for (r = field; *r != '\0'; r = re) {
SKIPWHITE(r);
if (*r == '\0')
break;
@ -152,7 +152,7 @@ int parseRCPOT(Spec spec, Package pkg, const char *field, int tag,
case RPMTAG_OBSOLETEFLAGS:
/* Add prereq on rpmlib that has versioned dependencies. */
if (!rpmExpandNumeric("%{_noVersionedDependencies}"))
rpmlibNeedsFeature(h, "VersionedDependencies", "3.0.3-1");
(void) rpmlibNeedsFeature(h, "VersionedDependencies", "3.0.3-1");
break;
default:
break;
@ -181,7 +181,7 @@ int parseRCPOT(Spec spec, Package pkg, const char *field, int tag,
} else
version = NULL;
addReqProv(spec, h, flags, req, version, index);
(void) addReqProv(spec, h, flags, req, version, index);
req = _free(req);
version = _free(version);

View File

@ -8,6 +8,8 @@
#include "rpmbuild.h"
#include "debug.h"
/*@access StringBuf@*/ /* XXX compared with NULL */
/**
*/
static int addTriggerIndex(Package pkg, const char *file, const char *script, const char *prog)
@ -29,7 +31,7 @@ static int addTriggerIndex(Package pkg, const char *file, const char *script, co
new = xmalloc(sizeof(*new));
new->fileName = (file) ? xstrdup(file) : NULL;
new->script = (*script) ? xstrdup(script) : NULL;
new->script = (script && *script != '\0') ? xstrdup(script) : NULL;
new->prog = xstrdup(prog);
new->index = index;
new->next = NULL;
@ -246,7 +248,7 @@ int parseScript(Spec spec, int parsePart)
stripTrailingBlanksStringBuf(sb);
p = getStringBuf(sb);
addReqProv(spec, pkg->header, (tagflags | RPMSENSE_INTERP), progArgv[0], NULL, 0);
(void) addReqProv(spec, pkg->header, (tagflags | RPMSENSE_INTERP), progArgv[0], NULL, 0);
/* Trigger script insertion is always delayed in order to */
/* get the index right. */
@ -259,14 +261,14 @@ int parseScript(Spec spec, int parsePart)
goto exit;
} else {
if (progArgc == 1)
headerAddEntry(pkg->header, progtag, RPM_STRING_TYPE,
(void) headerAddEntry(pkg->header, progtag, RPM_STRING_TYPE,
*progArgv, progArgc);
else
headerAddEntry(pkg->header, progtag, RPM_STRING_ARRAY_TYPE,
(void) headerAddEntry(pkg->header, progtag, RPM_STRING_ARRAY_TYPE,
progArgv, progArgc);
if (*p)
headerAddEntry(pkg->header, tag, RPM_STRING_TYPE, p, 1);
if (*p != '\0')
(void) headerAddEntry(pkg->header, tag, RPM_STRING_TYPE, p, 1);
if (file) {
switch (parsePart) {
@ -291,7 +293,7 @@ int parseScript(Spec spec, int parsePart)
rc = nextPart;
exit:
if (sb)
if (sb != NULL)
freeStringBuf(sb);
progArgv = _free(progArgv);
argv = _free(argv);

View File

@ -75,7 +75,7 @@ static int matchTok(const char *token, const char *line)
size_t toklen = strlen(token);
int rc = 0;
while ( *(b = be) ) {
while ( *(b = be) != '\0' ) {
SKIPSPACE(b);
be = b;
SKIPNONSPACE(be);
@ -152,7 +152,7 @@ static int copyNextLine(Spec spec, OFI_t *ofi, int strip)
}
/* Save 1st char of next line in order to terminate current line. */
if (*spec->nextline) {
if (*spec->nextline != '\0') {
spec->nextpeekc = *spec->nextline;
*spec->nextline = '\0';
}
@ -202,7 +202,7 @@ retry:
/* remove this file from the stack */
spec->fileStack = ofi->next;
Fclose(ofi->fd);
(void) Fclose(ofi->fd);
ofi->fileName = _free(ofi->fileName);
ofi = _free(ofi);
@ -345,7 +345,7 @@ void closeSpec(Spec spec)
while (spec->fileStack) {
ofi = spec->fileStack;
spec->fileStack = spec->fileStack->next;
if (ofi->fd) Fclose(ofi->fd);
if (ofi->fd) (void) Fclose(ofi->fd);
ofi->fileName = _free(ofi->fileName);
ofi = _free(ofi);
}
@ -546,15 +546,15 @@ fprintf(stderr, "*** PS buildRootURL(%s) %p macro set to %s\n", spec->buildRootU
for (pkg = spec->packages; pkg != NULL; pkg = pkg->next) {
if (!headerIsEntry(pkg->header, RPMTAG_DESCRIPTION)) {
const char * name;
headerNVR(pkg->header, &name, NULL, NULL);
(void) headerNVR(pkg->header, &name, NULL, NULL);
rpmError(RPMERR_BADSPEC, _("Package has no %%description: %s\n"),
name);
freeSpec(spec);
return RPMERR_BADSPEC;
}
headerAddEntry(pkg->header, RPMTAG_OS, RPM_STRING_TYPE, os, 1);
headerAddEntry(pkg->header, RPMTAG_ARCH, RPM_STRING_TYPE, arch, 1);
(void) headerAddEntry(pkg->header, RPMTAG_OS, RPM_STRING_TYPE, os, 1);
(void) headerAddEntry(pkg->header, RPMTAG_ARCH, RPM_STRING_TYPE, arch, 1);
}
#ifdef DYING
myos = _free(myos);

View File

@ -62,17 +62,17 @@ int addReqProv(/*@unused@*/ Spec spec, Header h,
/* Check for duplicate dependencies. */
if (hge(h, nametag, &dnt, (void **) &names, &len)) {
const char ** versions = NULL;
int dvt;
int dvt = RPM_STRING_ARRAY_TYPE;
int *flags = NULL;
int *indexes = NULL;
int duplicate = 0;
if (flagtag) {
hge(h, versiontag, &dvt, (void **) &versions, NULL);
hge(h, flagtag, NULL, (void **) &flags, NULL);
(void) hge(h, versiontag, &dvt, (void **) &versions, NULL);
(void) hge(h, flagtag, NULL, (void **) &flags, NULL);
}
if (indextag)
hge(h, indextag, NULL, (void **) &indexes, NULL);
(void) hge(h, indextag, NULL, (void **) &indexes, NULL);
while (len > 0) {
len--;
@ -101,15 +101,15 @@ int addReqProv(/*@unused@*/ Spec spec, Header h,
}
/* Add this dependency. */
headerAddOrAppendEntry(h, nametag, RPM_STRING_ARRAY_TYPE, &depName, 1);
(void) headerAddOrAppendEntry(h, nametag, RPM_STRING_ARRAY_TYPE, &depName, 1);
if (flagtag) {
headerAddOrAppendEntry(h, versiontag,
(void) headerAddOrAppendEntry(h, versiontag,
RPM_STRING_ARRAY_TYPE, &depEVR, 1);
headerAddOrAppendEntry(h, flagtag,
(void) headerAddOrAppendEntry(h, flagtag,
RPM_INT32_TYPE, &depFlags, 1);
}
if (indextag)
headerAddOrAppendEntry(h, indextag, RPM_INT32_TYPE, &index, 1);
(void) headerAddOrAppendEntry(h, indextag, RPM_INT32_TYPE, &index, 1);
return 0;
}

View File

@ -63,26 +63,30 @@ int lookupPackage(Spec spec, const char *name, int flag, /*@out@*/Package *pkg)
/* Construct package name */
{ char *n;
if (flag == PART_SUBNAME) {
headerNVR(spec->packages->header, &pname, NULL, NULL);
(void) headerNVR(spec->packages->header, &pname, NULL, NULL);
fullName = n = alloca(strlen(pname) + 1 + strlen(name) + 1);
while (*pname) *n++ = *pname++;
while (*pname != '\0') *n++ = *pname++;
*n++ = '-';
} else {
fullName = n = alloca(strlen(name)+1);
}
/*@-mayaliasunique@*/
strcpy(n, name);
/*@=mayaliasunique@*/
}
/* Locate package with fullName */
for (p = spec->packages; p != NULL; p = p->next) {
headerNVR(p->header, &pname, NULL, NULL);
(void) headerNVR(p->header, &pname, NULL, NULL);
if (pname && (! strcmp(fullName, pname))) {
break;
}
}
if (pkg)
/*@-dependenttrans@*/
*pkg = p;
/*@=dependenttrans@*/
return ((p == NULL) ? 1 : 0);
}
@ -168,7 +172,9 @@ void freePackages(Spec spec)
Package p;
while ((p = spec->packages) != NULL) {
/*@-dependenttrans@*/
spec->packages = p->next;
/*@=dependenttrans@*/
p->next = NULL;
freePackage(p);
}
@ -204,7 +210,7 @@ int parseNoSource(Spec spec, const char *field, int tag)
}
fe = field;
for (f = fe; *f; f = fe) {
for (f = fe; *f != '\0'; f = fe) {
struct Source *p;
SKIPWHITE(f);
@ -212,7 +218,7 @@ int parseNoSource(Spec spec, const char *field, int tag)
break;
fe = f;
SKIPNONWHITE(fe);
if (*fe) fe++;
if (*fe != '\0') fe++;
if (parseNum(f, &num)) {
rpmError(RPMERR_BADSPEC, _("line %d: Bad number: %s\n"),
@ -345,7 +351,9 @@ static inline void freeSl(/*@only@*/struct speclines *sl)
if (sl == NULL)
return;
for (i = 0; i < sl->sl_nlines; i++)
/*@-unqualifiedtrans@*/
sl->sl_lines[i] = _free(sl->sl_lines[i]);
/*@=unqualifiedtrans@*/
sl->sl_lines = _free(sl->sl_lines);
sl = _free(sl);
}
@ -466,7 +474,9 @@ void freeSpec(/*@only@*/ Spec spec)
while (spec->readStack) {
rl = spec->readStack;
/*@-dependenttrans@*/
spec->readStack = rl->next;
/*@=dependenttrans@*/
rl->next = NULL;
rl = _free(rl);
}
@ -488,10 +498,14 @@ void freeSpec(/*@only@*/ Spec spec)
if (!spec->inBuildArchitectures) {
while (spec->buildArchitectureCount--) {
/*@-unqualifiedtrans@*/
freeSpec(
spec->buildArchitectureSpecs[spec->buildArchitectureCount]);
/*@=unqualifiedtrans@*/
}
/*@-compdef@*/
spec->buildArchitectureSpecs = _free(spec->buildArchitectureSpecs);
/*@=compdef@*/
}
spec->buildArchitectures = _free(spec->buildArchitectures);

View File

@ -11,22 +11,16 @@
-unrecogcomments
# don't-bother-me-yet parameters
-branchstate # ~142 occurences, painful
#-immediatetrans
-mustfree # ~529 alloca is painful
#-observertrans
#-statictrans
-branchstate # ~140 painful
-mustfree # ~588 alloca is painful
# not-yet normal parameters
-boolops # w->n
#-fixedformalarray # md5 whines
-null
-predboolint # w->n
#-predboolothers # w->n
-retvalint # w->n
-type
-boolops # ~831 w->n
#-null # ~267
-predboolint # ~576 w->n
-type # ~872
# not-yet -weak paramaters
# -weak paramaters
#+boolint
#-boolops
#+ignorequals

View File

@ -57,9 +57,9 @@ getdate.c: getdate.y
@echo expect 10 shift/reduce conflicts
$(YACC) $(srcdir)/getdate.y
-@if test -f y.tab.c; then \
{ echo "/*@-unqualifiedtrans -usedef -varuse -globstate@*/";\
{ echo "/*@-globstate -retvalint -unqualifiedtrans -usedef -varuse@*/";\
cat y.tab.c ;\
echo "/*@=unqualifiedtrans =usedef =varuse =globstate@*/";\
echo "/*@=globstate =retvalint =unqualifiedtrans =usedef =varuse@*/";\
} > getdate.c ;\
rm -f y.tab.c; \
else \

View File

@ -16,8 +16,8 @@ static int _debug = 1; /* XXX if < 0 debugging, > 0 unusual error returns */
#endif
#endif
#define DB_VERSION_MAJOR 0
#define DB_VERSION_MINOR 0
#define DB_VERSION_MAJOR 1
#define DB_VERSION_MINOR 85
#define DB_VERSION_PATCH 0
#define _mymemset(_a, _b, _c)
@ -145,6 +145,16 @@ static void * doGetRecord(FD_t pkgs, unsigned int offset)
h = headerRead(pkgs, HEADER_MAGIC_NO);
/* let's sanity check this record a bit, otherwise just skip it */
if (!(headerIsEntry(h, RPMTAG_NAME) &&
headerIsEntry(h, RPMTAG_VERSION) &&
headerIsEntry(h, RPMTAG_RELEASE) &&
headerIsEntry(h, RPMTAG_BUILDTIME)))
{
headerFree(h);
h = NULL;
}
if (h == NULL)
goto exit;
@ -184,7 +194,7 @@ static void * doGetRecord(FD_t pkgs, unsigned int offset)
free(fileNames);
headerModifyEntry(h, RPMTAG_OLDFILENAMES, RPM_STRING_ARRAY_TYPE,
(void) headerModifyEntry(h, RPMTAG_OLDFILENAMES, RPM_STRING_ARRAY_TYPE,
newFileNames, fileCount);
}
@ -269,8 +279,11 @@ static int db1cget(dbiIndex dbi, /*@unused@*/ DBC * dbcursor, void ** keyp,
} else { /* XXX simulated retrieval */
data.data = doGetRecord(pkgs, offset);
data.size = 0; /* XXX WRONG */
if (data.data == NULL)
if (data.data == NULL) {
if (keyp) *keyp = key.data;
if (keylen) *keylen = key.size;
rc = EFAULT;
}
}
} else {
DB * db;
@ -484,7 +497,7 @@ exit:
dbi->dbi_vec = &db1vec;
*dbip = dbi;
} else
db1close(dbi, 0);
(void) db1close(dbi, 0);
base = _free(base);
urlfn = _free(urlfn);

View File

@ -565,7 +565,7 @@ static int db3close(/*@only@*/ dbiIndex dbi, /*@unused@*/ unsigned int flags)
#if defined(__USE_DB2) || defined(__USE_DB3)
if (dbi->dbi_rmw)
db3cclose(dbi, NULL, 0);
rc = db3cclose(dbi, NULL, 0);
if (db) {
rc = db->close(db, 0);
@ -834,7 +834,7 @@ static int db3open(/*@keep@*/ rpmdb rpmdb, int rpmtag, dbiIndex * dbip)
dbi->dbi_vec = &db3vec;
*dbip = dbi;
} else
db3close(dbi, 0);
(void) db3close(dbi, 0);
urlfn = _free(urlfn);

View File

@ -259,7 +259,7 @@ static /*@exposed@*/ struct availablePackage * alAddPackage(struct availableList
memset(&p->tsi, 0, sizeof(p->tsi));
p->multiLib = 0; /* MULTILIB */
headerNVR(p->h, &p->name, &p->version, &p->release);
(void) headerNVR(p->h, &p->name, &p->version, &p->release);
/* XXX This should be added always so that packages look alike.
* XXX However, there is logic in files.c/depends.c that checks for
@ -275,7 +275,7 @@ static /*@exposed@*/ struct availablePackage * alAddPackage(struct availableList
(void **) &pp, NULL)
&& !rpmVersionCompare(p->h, al->list[i].h)
&& *pp && !(*pp & multiLibMask))
p->multiLib = multiLibMask;
p->multiLib = multiLibMask;
}
}
@ -312,14 +312,14 @@ static /*@exposed@*/ struct availablePackage * alAddPackage(struct availableList
p->requireFlags = NULL;
}
if (!hge(h, RPMTAG_BASENAMES, &bnt, (void **) &p->baseNames, &p->filesCount))
if (!hge(h, RPMTAG_BASENAMES, &bnt, (void **)&p->baseNames, &p->filesCount))
{
p->filesCount = 0;
p->baseNames = NULL;
} else {
hge(h, RPMTAG_DIRNAMES, &dnt, (void **) &dirNames, &numDirs);
hge(h, RPMTAG_DIRINDEXES, NULL, (void **) &dirIndexes, NULL);
hge(h, RPMTAG_FILEFLAGS, NULL, (void **) &fileFlags, NULL);
(void) hge(h, RPMTAG_DIRNAMES, &dnt, (void **) &dirNames, &numDirs);
(void) hge(h, RPMTAG_DIRINDEXES, NULL, (void **) &dirIndexes, NULL);
(void) hge(h, RPMTAG_FILEFLAGS, NULL, (void **) &fileFlags, NULL);
/* XXX FIXME: We ought to relocate the directory list here */
@ -608,7 +608,6 @@ static int rangeMatchesDepFlags (Header h, const char *reqName, const char * req
int_32 * provideFlags;
int providesCount;
int result;
int type;
int i;
if (!(reqFlags & RPMSENSE_SENSEMASK) || !reqEVR || !strlen(reqEVR))
@ -623,7 +622,7 @@ static int rangeMatchesDepFlags (Header h, const char *reqName, const char * req
(void **) &providesEVR, &providesCount))
return 1;
hge(h, RPMTAG_PROVIDEFLAGS, &type, (void **) &provideFlags, &providesCount);
(void) hge(h, RPMTAG_PROVIDEFLAGS, NULL, (void **) &provideFlags, NULL);
if (!hge(h, RPMTAG_PROVIDENAME, &pnt, (void **) &provides, &providesCount))
{
@ -666,7 +665,7 @@ int headerMatchesDepFlags(Header h,
return 1;
/* Get package information from header */
headerNVR(h, &name, &version, &release);
(void) headerNVR(h, &name, &version, &release);
pkgEVR = p = alloca(21 + strlen(version) + 1 + strlen(release) + 1);
*p = '\0';
@ -789,7 +788,7 @@ int rpmtransAddPackage(rpmTransactionSet ts, Header h, FD_t fd,
if (headerIsEntry(h, RPMTAG_SOURCEPACKAGE))
return 0;
headerNVR(h, &name, NULL, NULL);
(void) headerNVR(h, &name, NULL, NULL);
{ rpmdbMatchIterator mi;
Header h2;
@ -815,12 +814,14 @@ int rpmtransAddPackage(rpmTransactionSet ts, Header h, FD_t fd,
}
if (hge(h, RPMTAG_OBSOLETENAME, &ont, (void **) &obsoletes, &count)) {
const char **obsoletesEVR;
int_32 *obsoletesFlags;
const char ** obsoletesEVR;
int_32 * obsoletesFlags;
int j;
hge(h, RPMTAG_OBSOLETEVERSION, &ovt, (void **) &obsoletesEVR, NULL);
hge(h, RPMTAG_OBSOLETEFLAGS, NULL, (void **) &obsoletesFlags, NULL);
(void) hge(h, RPMTAG_OBSOLETEVERSION, &ovt, (void **) &obsoletesEVR,
NULL);
(void) hge(h, RPMTAG_OBSOLETEFLAGS, NULL, (void **) &obsoletesFlags,
NULL);
for (j = 0; j < count; j++) {
@ -833,7 +834,7 @@ int rpmtransAddPackage(rpmTransactionSet ts, Header h, FD_t fd,
mi = rpmdbInitIterator(ts->rpmdb, RPMTAG_NAME, obsoletes[j], 0);
rpmdbPruneIterator(mi,
(void) rpmdbPruneIterator(mi,
ts->removedPackages, ts->numRemovedPackages, 1);
while((h2 = rpmdbNextIterator(mi)) != NULL) {
@ -1114,7 +1115,7 @@ static int unsatisfiedDepend(rpmTransactionSet ts,
mi = rpmdbInitIterator(ts->rpmdb, RPMTAG_BASENAMES, keyName, 0);
rpmdbPruneIterator(mi,
(void) rpmdbPruneIterator(mi,
ts->removedPackages, ts->numRemovedPackages, 1);
while ((h = rpmdbNextIterator(mi)) != NULL) {
@ -1127,7 +1128,7 @@ static int unsatisfiedDepend(rpmTransactionSet ts,
}
mi = rpmdbInitIterator(ts->rpmdb, RPMTAG_PROVIDENAME, keyName, 0);
rpmdbPruneIterator(mi,
(void) rpmdbPruneIterator(mi,
ts->removedPackages, ts->numRemovedPackages, 1);
while ((h = rpmdbNextIterator(mi)) != NULL) {
if (rangeMatchesDepFlags(h, keyName, keyEVR, keyFlags)) {
@ -1141,7 +1142,7 @@ static int unsatisfiedDepend(rpmTransactionSet ts,
#ifndef DYING
mi = rpmdbInitIterator(ts->rpmdb, RPMTAG_NAME, keyName, 0);
rpmdbPruneIterator(mi,
(void) rpmdbPruneIterator(mi,
ts->removedPackages, ts->numRemovedPackages, 1);
while ((h = rpmdbNextIterator(mi)) != NULL) {
if (rangeMatchesDepFlags(h, keyName, keyEVR, keyFlags)) {
@ -1213,17 +1214,15 @@ static int checkPackageDeps(rpmTransactionSet ts, struct problemsSet * psp,
int ourrc = 0;
struct availablePackage * suggestion;
headerNVR(h, &name, &version, &release);
(void) headerNVR(h, &name, &version, &release);
if (!hge(h, RPMTAG_REQUIRENAME, &rnt, (void **) &requires, &requiresCount))
{
requiresCount = 0;
rvt = RPM_STRING_ARRAY_TYPE;
} else {
hge(h, RPMTAG_REQUIREFLAGS, &type, (void **) &requireFlags,
&requiresCount);
hge(h, RPMTAG_REQUIREVERSION, &rvt,
(void **) &requiresEVR, &requiresCount);
(void)hge(h, RPMTAG_REQUIREFLAGS, NULL, (void **) &requireFlags, NULL);
(void)hge(h, RPMTAG_REQUIREVERSION, &rvt, (void **) &requiresEVR, NULL);
}
for (i = 0; i < requiresCount && !ourrc; i++) {
@ -1289,9 +1288,9 @@ static int checkPackageDeps(rpmTransactionSet ts, struct problemsSet * psp,
conflictsCount = 0;
cvt = RPM_STRING_ARRAY_TYPE;
} else {
hge(h, RPMTAG_CONFLICTFLAGS, &type,
(void) hge(h, RPMTAG_CONFLICTFLAGS, &type,
(void **) &conflictFlags, &conflictsCount);
hge(h, RPMTAG_CONFLICTVERSION, &cvt,
(void) hge(h, RPMTAG_CONFLICTVERSION, &cvt,
(void **) &conflictsEVR, &conflictsCount);
}
@ -1363,7 +1362,8 @@ static int checkPackageSet(rpmTransactionSet ts, struct problemsSet * psp,
Header h;
int rc = 0;
rpmdbPruneIterator(mi, ts->removedPackages, ts->numRemovedPackages, 1);
(void) rpmdbPruneIterator(mi,
ts->removedPackages, ts->numRemovedPackages, 1);
while ((h = rpmdbNextIterator(mi)) != NULL) {
if (checkPackageDeps(ts, psp, h, key, 0)) {
rc = 1;
@ -1972,11 +1972,12 @@ int rpmdepCheck(rpmTransactionSet ts,
*/
if (ts->numRemovedPackages > 0) {
mi = rpmdbInitIterator(ts->rpmdb, RPMDBI_PACKAGES, NULL, 0);
rpmdbAppendIterator(mi, ts->removedPackages, ts->numRemovedPackages);
(void) rpmdbAppendIterator(mi,
ts->removedPackages, ts->numRemovedPackages);
while ((h = rpmdbNextIterator(mi)) != NULL) {
{ const char * name, * version, * release;
headerNVR(h, &name, &version, &release);
(void) headerNVR(h, &name, &version, &release);
rpmMessage(RPMMESS_DEBUG, ("========== --- %s-%s-%s\n"),
name, version, release);
@ -2016,8 +2017,9 @@ int rpmdepCheck(rpmTransactionSet ts,
if (hge(h, RPMTAG_BASENAMES, &bnt, (void **) &baseNames, &fileCount))
{
hge(h, RPMTAG_DIRNAMES, &dnt, (void **) &dirNames, NULL);
hge(h, RPMTAG_DIRINDEXES, NULL, (void **) &dirIndexes, NULL);
(void) hge(h, RPMTAG_DIRNAMES, &dnt, (void **) &dirNames, NULL);
(void) hge(h, RPMTAG_DIRINDEXES, NULL, (void **) &dirIndexes,
NULL);
rc = 0;
for (j = 0; j < fileCount; j++) {
len = strlen(baseNames[j]) + 1 +

View File

@ -76,7 +76,7 @@ FD_t fadOpen(const char * path, int flags, mode_t perms)
newHdr.magic = FA_MAGIC;
newHdr.firstFree = 0;
if (Fwrite(&newHdr, sizeof(char), sizeof(newHdr), fd) != sizeof(newHdr)) {
Fclose(fd);
(void) Fclose(fd);
return NULL;
}
fadSetFirstFree(fd, 0);
@ -84,18 +84,18 @@ FD_t fadOpen(const char * path, int flags, mode_t perms)
} else {
memset(&newHdr, 0, sizeof(newHdr));
if (Pread(fd, &newHdr, sizeof(newHdr), 0) != sizeof(newHdr)) {
Fclose(fd);
(void) Fclose(fd);
return NULL;
}
if (newHdr.magic != FA_MAGIC) {
Fclose(fd);
(void) Fclose(fd);
return NULL;
}
fadSetFirstFree(fd, newHdr.firstFree);
fadSetFileSize(fd, Fseek(fd, 0, SEEK_END));
if (fadGetFileSize(fd) < 0) {
Fclose(fd);
(void) Fclose(fd);
return NULL;
}
}

View File

@ -280,10 +280,10 @@ static int triggercondsTag(Header h, /*@out@*/ int_32 * type,
return 0;
}
hge(h, RPMTAG_TRIGGERINDEX, NULL, (void **) &indices, NULL);
hge(h, RPMTAG_TRIGGERFLAGS, NULL, (void **) &flags, NULL);
hge(h, RPMTAG_TRIGGERVERSION, &tvt, (void **) &versions, NULL);
hge(h, RPMTAG_TRIGGERSCRIPTS, &tst, (void **) &s, &numScripts);
(void) hge(h, RPMTAG_TRIGGERINDEX, NULL, (void **) &indices, NULL);
(void) hge(h, RPMTAG_TRIGGERFLAGS, NULL, (void **) &flags, NULL);
(void) hge(h, RPMTAG_TRIGGERVERSION, &tvt, (void **) &versions, NULL);
(void) hge(h, RPMTAG_TRIGGERSCRIPTS, &tst, (void **) &s, &numScripts);
s = hfd(s, tst);
*freeData = 1;
@ -348,8 +348,8 @@ static int triggertypeTag(Header h, /*@out@*/ int_32 * type,
return 1;
}
hge(h, RPMTAG_TRIGGERFLAGS, NULL, (void **) &flags, NULL);
hge(h, RPMTAG_TRIGGERSCRIPTS, &tst, (void **) &s, &numScripts);
(void) hge(h, RPMTAG_TRIGGERFLAGS, NULL, (void **) &flags, NULL);
(void) hge(h, RPMTAG_TRIGGERSCRIPTS, &tst, (void **) &s, &numScripts);
s = hfd(s, tst);
*freeData = 1;
@ -435,7 +435,7 @@ static int i18nTag(Header h, int_32 tag, /*@out@*/ int_32 * type,
{ const char * tn = tagName(tag);
const char * n;
char * mk;
headerNVR(h, &n, NULL, NULL);
(void) headerNVR(h, &n, NULL, NULL);
mk = alloca(strlen(n) + strlen(tn) + sizeof("()"));
sprintf(mk, "%s(%s)", n, tn);
msgkey = mk;
@ -443,7 +443,7 @@ static int i18nTag(Header h, int_32 tag, /*@out@*/ int_32 * type,
/* change to en_US for msgkey -> msgid resolution */
langval = getenv(language);
setenv(language, "en_US", 1);
(void) setenv(language, "en_US", 1);
++_nl_msg_cat_cntr;
msgid = NULL;
@ -456,7 +456,7 @@ static int i18nTag(Header h, int_32 tag, /*@out@*/ int_32 * type,
/* restore previous environment for msgid -> msgstr resolution */
if (langval)
setenv(language, langval, 1);
(void) setenv(language, langval, 1);
else
unsetenv(language);
++_nl_msg_cat_cntr;

View File

@ -228,18 +228,19 @@ void fpLookupList(fingerPrintCache cache, const char ** dirNames,
void fpLookupHeader(fingerPrintCache cache, Header h, fingerPrint * fpList)
{
int fileCount;
HGE_t hge = (HGE_t)headerGetEntryMinMemory;
HFD_t hfd = headerFreeData;
const char ** baseNames, ** dirNames;
int bnt, dnt;
int_32 * dirIndexes;
int fileCount;
if (!headerGetEntryMinMemory(h, RPMTAG_BASENAMES, NULL,
(const void **) &baseNames, &fileCount)) return;
if (!hge(h, RPMTAG_BASENAMES, &bnt, (void **) &baseNames, &fileCount))
return;
headerGetEntryMinMemory(h, RPMTAG_DIRNAMES, NULL,
(const void **) &dirNames, NULL);
headerGetEntryMinMemory(h, RPMTAG_DIRINDEXES, NULL,
(const void **) &dirIndexes, NULL);
(void) hge(h, RPMTAG_DIRNAMES, &dnt, (void **) &dirNames, NULL);
(void) hge(h, RPMTAG_DIRINDEXES, NULL, (void **) &dirIndexes, NULL);
fpLookupList(cache, dirNames, baseNames, dirIndexes, fileCount, fpList);
free(dirNames);
free(baseNames);
dirNames = hfd(dirNames, dnt);
baseNames = hfd(baseNames, bnt);
}

View File

@ -204,9 +204,9 @@ static int getFilesystemList(void)
}
# if GETMNTENT_ONE || GETMNTENT_TWO
fclose(mtab);
(void) fclose(mtab);
# elif HAVE_GETMNTINFO_R
free(mounts);
mounts = _free(mounts);
# endif
filesystems[numFilesystems].dev = 0;

View File

@ -648,7 +648,7 @@ static int expandRegular(FSM_t fsm)
if (st->st_size > 0 && fmd5sum) {
const char * md5sum = NULL;
Fflush(fsm->wfd);
(void) Fflush(fsm->wfd);
fdFiniMD5(fsm->wfd, (void **)&md5sum, NULL, 1);
if (md5sum == NULL) {
@ -761,7 +761,7 @@ static int writeFile(FSM_t fsm, int writeData)
#if HAVE_MMAP
if (mapped != (void *)-1) {
/*@-noeffect@*/ munmap(mapped, nmapped) /*@=noeffect@*/;
/*@-noeffect@*/ (void) munmap(mapped, nmapped) /*@=noeffect@*/;
fsm->rdbuf = rdbuf;
}
#endif

View File

@ -1,3 +1,4 @@
/*@-globstate -retvalint -unqualifiedtrans -usedef -varuse@*/
#ifndef lint
static char const
yyrcsid[] = "$FreeBSD: src/usr.bin/yacc/skeleton.c,v 1.28 2000/01/17 02:04:06 bde Exp $";
@ -123,15 +124,20 @@ struct timeb {
unportable getdate.c's), but that seems to cause as many problems
as it solves. */
#if 0
extern struct tm *gmtime();
extern struct tm *localtime();
#endif
extern time_t get_date(char * p, struct timeb * now);
#define yyparse getdate_yyparse
#define yylex getdate_yylex
#define yyerror getdate_yyerror
static int yylex ();
static int yyerror ();
static int yyparse (void);
static int yylex (void);
static int yyerror(const char * s);
#define EPOCH 1970
#define HOUR(x) ((time_t)(x) * 60)
@ -189,12 +195,12 @@ static MERIDIAN yyMeridian;
static time_t yyRelMonth;
static time_t yyRelSeconds;
#line 179 "./getdate.y"
#line 184 "./getdate.y"
typedef union {
time_t Number;
enum _MERIDIAN Meridian;
} YYSTYPE;
#line 198 "y.tab.c"
#line 203 "y.tab.c"
#define YYERRCODE 256
#define tAGO 257
#define tDAY 258
@ -412,7 +418,7 @@ short *yyss;
short *yysslim;
YYSTYPE *yyvs;
int yystacksize;
#line 398 "./getdate.y"
#line 403 "./getdate.y"
/* Month and day table. */
static TABLE const MonthDayTable[] = {
@ -440,7 +446,7 @@ static TABLE const MonthDayTable[] = {
{ "thurs", tDAY, 4 },
{ "friday", tDAY, 5 },
{ "saturday", tDAY, 6 },
{ NULL }
{ NULL, 0, 0 }
};
/* Time units table. */
@ -455,7 +461,7 @@ static TABLE const UnitsTable[] = {
{ "min", tMINUTE_UNIT, 1 },
{ "second", tSEC_UNIT, 1 },
{ "sec", tSEC_UNIT, 1 },
{ NULL }
{ NULL, 0, 0 }
};
/* Assorted relative-time words. */
@ -480,7 +486,7 @@ static TABLE const OtherTable[] = {
{ "eleventh", tUNUMBER, 11 },
{ "twelfth", tUNUMBER, 12 },
{ "ago", tAGO, 1 },
{ NULL }
{ NULL, 0, 0 }
};
/* The timezone table. */
@ -565,7 +571,7 @@ static TABLE const TimezoneTable[] = {
{ "nzst", tZONE, -HOUR(12) }, /* New Zealand Standard */
{ "nzdt", tDAYZONE, -HOUR(12) }, /* New Zealand Daylight */
{ "idle", tZONE, -HOUR(12) }, /* International Date Line East */
{ NULL }
{ NULL, 0, 0 }
};
/* Military timezone table. */
@ -595,7 +601,7 @@ static TABLE const MilitaryTable[] = {
{ "x", tZONE, HOUR(-11) },
{ "y", tZONE, HOUR(-12) },
{ "z", tZONE, HOUR( 0) },
{ NULL }
{ NULL, 0, 0 }
};
@ -603,19 +609,14 @@ static TABLE const MilitaryTable[] = {
/* ARGSUSED */
static int
yyerror(s)
char *s;
yyerror(const char * s)
{
return 0;
}
static time_t
ToSeconds(Hours, Minutes, Seconds, Meridian)
time_t Hours;
time_t Minutes;
time_t Seconds;
MERIDIAN Meridian;
ToSeconds(time_t Hours, time_t Minutes, time_t Seconds, MERIDIAN Meridian)
{
if (Minutes < 0 || Minutes > 59 || Seconds < 0 || Seconds > 59)
return -1;
@ -648,15 +649,9 @@ ToSeconds(Hours, Minutes, Seconds, Meridian)
* A number from 0 to 99, which means a year from 1900 to 1999, or
* The actual year (>=100). */
static time_t
Convert(Month, Day, Year, Hours, Minutes, Seconds, Meridian, DSTmode)
time_t Month;
time_t Day;
time_t Year;
time_t Hours;
time_t Minutes;
time_t Seconds;
MERIDIAN Meridian;
DSTMODE DSTmode;
Convert(time_t Month, time_t Day, time_t Year,
time_t Hours, time_t Minutes, time_t Seconds,
MERIDIAN Meridian, DSTMODE DSTmode)
{
static int DaysInMonth[12] = {
31, 0, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31
@ -698,9 +693,7 @@ Convert(Month, Day, Year, Hours, Minutes, Seconds, Meridian, DSTmode)
static time_t
DSTcorrect(Start, Future)
time_t Start;
time_t Future;
DSTcorrect(time_t Start, time_t Future)
{
time_t StartDay;
time_t FutureDay;
@ -712,10 +705,7 @@ DSTcorrect(Start, Future)
static time_t
RelativeDate(Start, DayOrdinal, DayNumber)
time_t Start;
time_t DayOrdinal;
time_t DayNumber;
RelativeDate(time_t Start, time_t DayOrdinal, time_t DayNumber)
{
struct tm *tm;
time_t now;
@ -729,9 +719,7 @@ RelativeDate(Start, DayOrdinal, DayNumber)
static time_t
RelativeMonth(Start, RelMonth)
time_t Start;
time_t RelMonth;
RelativeMonth(time_t Start, time_t RelMonth)
{
struct tm *tm;
time_t Month;
@ -751,8 +739,7 @@ RelativeMonth(Start, RelMonth)
static int
LookupWord(buff)
char *buff;
LookupWord(char * buff)
{
register char *p;
register char *q;
@ -761,7 +748,7 @@ LookupWord(buff)
int abbrev;
/* Make it lowercase. */
for (p = buff; *p; p++)
for (p = buff; *p != '\0'; p++)
if (isupper(*p))
*p = tolower(*p);
@ -840,7 +827,7 @@ LookupWord(buff)
}
/* Drop out any periods and try the timezone table again. */
for (i = 0, p = q = buff; *q; q++)
for (i = 0, p = q = buff; *q != '\0'; q++)
if (*q != '.')
*p++ = *q;
else
@ -858,7 +845,7 @@ LookupWord(buff)
static int
yylex()
yylex(void)
{
register char c;
register char *p;
@ -907,17 +894,18 @@ yylex()
Count--;
} while (Count > 0);
}
/*@notreached@*/
return 0;
}
#define TM_YEAR_ORIGIN 1900
/* Yield A - B, measured in seconds. */
static long
difftm (a, b)
struct tm *a, *b;
difftm (const struct tm * a, const struct tm * b)
{
int ay = a->tm_year + (TM_YEAR_ORIGIN - 1);
int by = b->tm_year + (TM_YEAR_ORIGIN - 1);
unsigned ay = a->tm_year + (TM_YEAR_ORIGIN - 1);
unsigned by = b->tm_year + (TM_YEAR_ORIGIN - 1);
int days = (
/* difference in day of year */
a->tm_yday - b->tm_yday
@ -934,9 +922,7 @@ difftm (a, b)
}
time_t
get_date(p, now)
char *p;
struct timeb *now;
get_date(char * p, struct timeb * now)
{
struct tm *tm, gmt;
struct timeb ftz;
@ -945,6 +931,7 @@ get_date(p, now)
time_t nowtime;
yyInput = p;
memset(&gmt, 0, sizeof(gmt));
if (now == NULL) {
struct tm *gmt_ptr;
@ -965,7 +952,9 @@ get_date(p, now)
return -1;
if (gmt_ptr != NULL)
/*@-observertrans -dependenttrans@*/
ftz.timezone = difftm (&gmt, tm) / 60;
/*@=observertrans =dependenttrans@*/
else
/* We are on a system like VMS, where the system clock is
in local time and the system has no concept of timezones.
@ -1000,9 +989,11 @@ get_date(p, now)
yyHaveTime = 0;
yyHaveZone = 0;
/*@-unrecog@*/
if (yyparse()
|| yyHaveTime > 1 || yyHaveZone > 1 || yyHaveDate > 1 || yyHaveDay > 1)
return -1;
/*@=unrecog@*/
if (yyHaveDate || yyHaveTime || yyHaveDay) {
Start = Convert(yyMonth, yyDay, yyYear, yyHour, yyMinutes, yySeconds,
@ -1056,7 +1047,7 @@ main(ac, av)
/* NOTREACHED */
}
#endif /* defined(TEST) */
#line 1060 "y.tab.c"
#line 1050 "y.tab.c"
/* allocate initial stack or double stack size, up to YYMAXDEPTH */
static int yygrowstack()
{
@ -1252,37 +1243,37 @@ yyreduce:
switch (yyn)
{
case 3:
#line 197 "./getdate.y"
#line 202 "./getdate.y"
{
yyHaveTime++;
}
break;
case 4:
#line 200 "./getdate.y"
#line 205 "./getdate.y"
{
yyHaveZone++;
}
break;
case 5:
#line 203 "./getdate.y"
#line 208 "./getdate.y"
{
yyHaveDate++;
}
break;
case 6:
#line 206 "./getdate.y"
#line 211 "./getdate.y"
{
yyHaveDay++;
}
break;
case 7:
#line 209 "./getdate.y"
#line 214 "./getdate.y"
{
yyHaveRel++;
}
break;
case 9:
#line 215 "./getdate.y"
#line 220 "./getdate.y"
{
yyHour = yyvsp[-1].Number;
yyMinutes = 0;
@ -1291,7 +1282,7 @@ case 9:
}
break;
case 10:
#line 221 "./getdate.y"
#line 226 "./getdate.y"
{
yyHour = yyvsp[-3].Number;
yyMinutes = yyvsp[-1].Number;
@ -1300,7 +1291,7 @@ case 10:
}
break;
case 11:
#line 227 "./getdate.y"
#line 232 "./getdate.y"
{
yyHour = yyvsp[-3].Number;
yyMinutes = yyvsp[-1].Number;
@ -1310,7 +1301,7 @@ case 11:
}
break;
case 12:
#line 234 "./getdate.y"
#line 239 "./getdate.y"
{
yyHour = yyvsp[-5].Number;
yyMinutes = yyvsp[-3].Number;
@ -1319,7 +1310,7 @@ case 12:
}
break;
case 13:
#line 240 "./getdate.y"
#line 245 "./getdate.y"
{
yyHour = yyvsp[-5].Number;
yyMinutes = yyvsp[-3].Number;
@ -1330,56 +1321,56 @@ case 13:
}
break;
case 14:
#line 250 "./getdate.y"
#line 255 "./getdate.y"
{
yyTimezone = yyvsp[0].Number;
yyDSTmode = DSToff;
}
break;
case 15:
#line 254 "./getdate.y"
#line 259 "./getdate.y"
{
yyTimezone = yyvsp[0].Number;
yyDSTmode = DSTon;
}
break;
case 16:
#line 259 "./getdate.y"
#line 264 "./getdate.y"
{
yyTimezone = yyvsp[-1].Number;
yyDSTmode = DSTon;
}
break;
case 17:
#line 265 "./getdate.y"
#line 270 "./getdate.y"
{
yyDayOrdinal = 1;
yyDayNumber = yyvsp[0].Number;
}
break;
case 18:
#line 269 "./getdate.y"
#line 274 "./getdate.y"
{
yyDayOrdinal = 1;
yyDayNumber = yyvsp[-1].Number;
}
break;
case 19:
#line 273 "./getdate.y"
#line 278 "./getdate.y"
{
yyDayOrdinal = yyvsp[-1].Number;
yyDayNumber = yyvsp[0].Number;
}
break;
case 20:
#line 279 "./getdate.y"
#line 284 "./getdate.y"
{
yyMonth = yyvsp[-2].Number;
yyDay = yyvsp[0].Number;
}
break;
case 21:
#line 283 "./getdate.y"
#line 288 "./getdate.y"
{
if (yyvsp[-4].Number >= 100) {
yyYear = yyvsp[-4].Number;
@ -1393,7 +1384,7 @@ case 21:
}
break;
case 22:
#line 294 "./getdate.y"
#line 299 "./getdate.y"
{
/* ISO 8601 format. yyyy-mm-dd. */
yyYear = yyvsp[-2].Number;
@ -1402,7 +1393,7 @@ case 22:
}
break;
case 23:
#line 300 "./getdate.y"
#line 305 "./getdate.y"
{
/* e.g. 17-JUN-1992. */
yyDay = yyvsp[-2].Number;
@ -1411,14 +1402,14 @@ case 23:
}
break;
case 24:
#line 306 "./getdate.y"
#line 311 "./getdate.y"
{
yyMonth = yyvsp[-1].Number;
yyDay = yyvsp[0].Number;
}
break;
case 25:
#line 310 "./getdate.y"
#line 315 "./getdate.y"
{
yyMonth = yyvsp[-3].Number;
yyDay = yyvsp[-2].Number;
@ -1426,14 +1417,14 @@ case 25:
}
break;
case 26:
#line 315 "./getdate.y"
#line 320 "./getdate.y"
{
yyMonth = yyvsp[0].Number;
yyDay = yyvsp[-1].Number;
}
break;
case 27:
#line 319 "./getdate.y"
#line 324 "./getdate.y"
{
yyMonth = yyvsp[-1].Number;
yyDay = yyvsp[-2].Number;
@ -1441,68 +1432,68 @@ case 27:
}
break;
case 28:
#line 326 "./getdate.y"
#line 331 "./getdate.y"
{
yyRelSeconds = -yyRelSeconds;
yyRelMonth = -yyRelMonth;
}
break;
case 30:
#line 333 "./getdate.y"
#line 338 "./getdate.y"
{
yyRelSeconds += yyvsp[-1].Number * yyvsp[0].Number * 60L;
}
break;
case 31:
#line 336 "./getdate.y"
#line 341 "./getdate.y"
{
yyRelSeconds += yyvsp[-1].Number * yyvsp[0].Number * 60L;
}
break;
case 32:
#line 339 "./getdate.y"
#line 344 "./getdate.y"
{
yyRelSeconds += yyvsp[0].Number * 60L;
}
break;
case 33:
#line 342 "./getdate.y"
#line 347 "./getdate.y"
{
yyRelSeconds += yyvsp[-1].Number;
}
break;
case 34:
#line 345 "./getdate.y"
#line 350 "./getdate.y"
{
yyRelSeconds += yyvsp[-1].Number;
}
break;
case 35:
#line 348 "./getdate.y"
#line 353 "./getdate.y"
{
yyRelSeconds++;
}
break;
case 36:
#line 351 "./getdate.y"
#line 356 "./getdate.y"
{
yyRelMonth += yyvsp[-1].Number * yyvsp[0].Number;
}
break;
case 37:
#line 354 "./getdate.y"
#line 359 "./getdate.y"
{
yyRelMonth += yyvsp[-1].Number * yyvsp[0].Number;
}
break;
case 38:
#line 357 "./getdate.y"
#line 362 "./getdate.y"
{
yyRelMonth += yyvsp[0].Number;
}
break;
case 39:
#line 362 "./getdate.y"
#line 367 "./getdate.y"
{
if (yyHaveTime && yyHaveDate && !yyHaveRel)
yyYear = yyvsp[0].Number;
@ -1530,18 +1521,18 @@ case 39:
}
break;
case 40:
#line 389 "./getdate.y"
#line 394 "./getdate.y"
{
yyval.Meridian = MER24;
}
break;
case 41:
#line 392 "./getdate.y"
#line 397 "./getdate.y"
{
yyval.Meridian = yyvsp[0].Meridian;
}
break;
#line 1545 "y.tab.c"
#line 1535 "y.tab.c"
}
yyssp -= yym;
yystate = *yyssp;
@ -1598,3 +1589,4 @@ yyabort:
yyaccept:
return (0);
}
/*@=globstate =retvalint =unqualifiedtrans =usedef =varuse@*/

View File

@ -481,7 +481,7 @@ Header headerCopy(Header h)
headerNextIterator(hi, &tag, &type, &ptr, &count);
ptr = headerFreeData((void *)ptr, type))
{
headerAddEntry(nh, tag, type, ptr, count);
(void) headerAddEntry(nh, tag, type, ptr, count);
}
headerFreeIterator(hi);
@ -595,9 +595,9 @@ assert(rdlen == dl);
/* Dribble entries replace duplicate region entries. */
h->indexUsed -= ne;
for (j = 0; j < ne; j++, newEntry++) {
headerRemoveEntry(h, newEntry->info.tag);
(void) headerRemoveEntry(h, newEntry->info.tag);
if (newEntry->info.tag == HEADER_BASENAMES)
headerRemoveEntry(h, HEADER_OLDFILENAMES);
(void) headerRemoveEntry(h, HEADER_OLDFILENAMES);
}
/* If any duplicate entries were replaced, move new entries down. */
@ -2214,7 +2214,8 @@ static int parseExpression(struct sprintfToken * token, char * str,
}
if (*chptr == '|') {
parseFormat(xstrdup(""), tags, extensions, &token->u.cond.elseFormat,
(void) parseFormat(xstrdup(""), tags, extensions,
&token->u.cond.elseFormat,
&token->u.cond.numElseTokens, &end, PARSER_IN_EXPR,
errmsg);
} else {
@ -2768,7 +2769,7 @@ void headerCopyTags(Header headerFrom, Header headerTo, int *tagstocopy)
if (!headerGetEntryMinMemory(headerFrom, *p, &type,
(const void **) &s, &count))
continue;
headerAddEntry(headerTo, *p, type, s, count);
(void) headerAddEntry(headerTo, *p, type, s, count);
s = headerFreeData(s, type);
}
}

View File

@ -46,7 +46,7 @@ static int domd5(const char * fn, unsigned char * digest, int asAscii,
rpmMD5Update(&ctx, buf, rc);
rpmMD5Final(bindigest, &ctx);
if (ferror(fp)) {
fclose(fp);
(void) fclose(fp);
return 1;
}
@ -73,7 +73,7 @@ static int domd5(const char * fn, unsigned char * digest, int asAscii,
(unsigned)bindigest[15]);
}
fclose(fp);
(void) fclose(fp);
rc = 0;
#else
FD_t fd = Fopen(fn, "r.ufdio");

View File

@ -358,7 +358,7 @@ int makeTempFile(const char * prefix, const char ** fnptr, FD_t * fdptr)
errxit:
tempfn = _free(tempfn);
/*@-usereleased@*/
if (fd) Fclose(fd);
if (fd) (void) Fclose(fd);
/*@=usereleased@*/
return 1;
}
@ -389,6 +389,7 @@ static int dncmp(const void * a, const void * b)
void compressFilelist(Header h)
{
HGE_t hge = (HGE_t)headerGetEntryMinMemory;
char ** fileNames;
const char ** dirNames;
const char ** baseNames;
@ -405,12 +406,11 @@ void compressFilelist(Header h)
*/
if (headerIsEntry(h, RPMTAG_DIRNAMES)) {
headerRemoveEntry(h, RPMTAG_OLDFILENAMES);
(void) headerRemoveEntry(h, RPMTAG_OLDFILENAMES);
return; /* Already converted. */
}
if (!headerGetEntry(h, RPMTAG_OLDFILENAMES, &fnt,
(void **) &fileNames, &count))
if (!hge(h, RPMTAG_OLDFILENAMES, &fnt, (void **) &fileNames, &count))
return; /* no file list */
dirNames = alloca(sizeof(*dirNames) * count); /* worst case */
@ -452,16 +452,16 @@ void compressFilelist(Header h)
}
exit:
headerAddEntry(h, RPMTAG_DIRINDEXES, RPM_INT32_TYPE,
(void) headerAddEntry(h, RPMTAG_DIRINDEXES, RPM_INT32_TYPE,
dirIndexes, count);
headerAddEntry(h, RPMTAG_BASENAMES, RPM_STRING_ARRAY_TYPE,
(void) headerAddEntry(h, RPMTAG_BASENAMES, RPM_STRING_ARRAY_TYPE,
baseNames, count);
headerAddEntry(h, RPMTAG_DIRNAMES, RPM_STRING_ARRAY_TYPE,
(void) headerAddEntry(h, RPMTAG_DIRNAMES, RPM_STRING_ARRAY_TYPE,
dirNames, dirIndex + 1);
fileNames = headerFreeData(fileNames, fnt);
headerRemoveEntry(h, RPMTAG_OLDFILENAMES);
(void) headerRemoveEntry(h, RPMTAG_OLDFILENAMES);
}
/*
@ -472,6 +472,8 @@ static void doBuildFileList(Header h, /*@out@*/ const char *** fileListPtr,
/*@out@*/ int * fileCountPtr, int baseNameTag,
int dirNameTag, int dirIndexesTag)
{
HGE_t hge = (HGE_t)headerGetEntryMinMemory;
HFD_t hfd = headerFreeData;
const char ** baseNames;
const char ** dirNames;
int * dirIndexes;
@ -482,14 +484,14 @@ static void doBuildFileList(Header h, /*@out@*/ const char *** fileListPtr,
char * data;
int i;
if (!headerGetEntry(h, baseNameTag, &bnt, (void **) &baseNames, &count)) {
if (!hge(h, baseNameTag, &bnt, (void **) &baseNames, &count)) {
if (fileListPtr) *fileListPtr = NULL;
if (fileCountPtr) *fileCountPtr = 0;
return; /* no file list */
}
headerGetEntry(h, dirNameTag, &dnt, (void **) &dirNames, NULL);
headerGetEntry(h, dirIndexesTag, NULL, (void **) &dirIndexes, &count);
(void) hge(h, dirNameTag, &dnt, (void **) &dirNames, NULL);
(void) hge(h, dirIndexesTag, NULL, (void **) &dirIndexes, &count);
size = sizeof(*fileNames) * count;
for (i = 0; i < count; i++)
@ -502,8 +504,8 @@ static void doBuildFileList(Header h, /*@out@*/ const char *** fileListPtr,
data = stpcpy( stpcpy(data, dirNames[dirIndexes[i]]), baseNames[i]);
*data++ = '\0';
}
baseNames = headerFreeData(baseNames, bnt);
dirNames = headerFreeData(dirNames, dnt);
baseNames = hfd(baseNames, bnt);
dirNames = hfd(dirNames, dnt);
if (fileListPtr)
*fileListPtr = fileNames;
@ -522,14 +524,14 @@ void expandFilelist(Header h)
RPMTAG_DIRNAMES, RPMTAG_DIRINDEXES);
if (fileNames == NULL || count <= 0)
return;
headerAddEntry(h, RPMTAG_OLDFILENAMES, RPM_STRING_ARRAY_TYPE,
(void) headerAddEntry(h, RPMTAG_OLDFILENAMES, RPM_STRING_ARRAY_TYPE,
fileNames, count);
fileNames = _free(fileNames);
}
headerRemoveEntry(h, RPMTAG_DIRNAMES);
headerRemoveEntry(h, RPMTAG_BASENAMES);
headerRemoveEntry(h, RPMTAG_DIRINDEXES);
(void) headerRemoveEntry(h, RPMTAG_DIRNAMES);
(void) headerRemoveEntry(h, RPMTAG_BASENAMES);
(void) headerRemoveEntry(h, RPMTAG_DIRINDEXES);
}
@ -779,6 +781,8 @@ int rpmPackageGetEntry( /*@unused@*/ void *leadp, Header sigs, Header h,
*/
void providePackageNVR(Header h)
{
HGE_t hge = (HGE_t)headerGetEntryMinMemory;
HFD_t hfd = headerFreeData;
const char *name, *version, *release;
int_32 * epoch;
const char *pEVR;
@ -786,18 +790,19 @@ void providePackageNVR(Header h)
int_32 pFlags = RPMSENSE_EQUAL;
const char ** provides = NULL;
const char ** providesEVR = NULL;
int pnt, pvt;
int_32 * provideFlags = NULL;
int providesCount;
int i;
int bingo = 1;
/* Generate provides for this package name-version-release. */
headerNVR(h, &name, &version, &release);
(void) headerNVR(h, &name, &version, &release);
if (!(name && version && release))
return;
pEVR = p = alloca(21 + strlen(version) + 1 + strlen(release) + 1);
*p = '\0';
if (headerGetEntry(h, RPMTAG_EPOCH, NULL, (void **) &epoch, NULL)) {
if (hge(h, RPMTAG_EPOCH, NULL, (void **) &epoch, NULL)) {
sprintf(p, "%d:", *epoch);
while (*p != '\0')
p++;
@ -808,29 +813,25 @@ void providePackageNVR(Header h)
* Rpm prior to 3.0.3 does not have versioned provides.
* If no provides at all are available, we can just add.
*/
if (!headerGetEntry(h, RPMTAG_PROVIDENAME, NULL,
(void **) &provides, &providesCount)) {
if (!hge(h, RPMTAG_PROVIDENAME, &pnt, (void **) &provides, &providesCount))
goto exit;
}
/*
* Otherwise, fill in entries on legacy packages.
*/
if (!headerGetEntry(h, RPMTAG_PROVIDEVERSION, NULL,
(void **) &providesEVR, NULL)) {
if (!hge(h, RPMTAG_PROVIDEVERSION, &pvt, (void **) &providesEVR, NULL)) {
for (i = 0; i < providesCount; i++) {
char * vdummy = "";
int_32 fdummy = RPMSENSE_ANY;
headerAddOrAppendEntry(h, RPMTAG_PROVIDEVERSION, RPM_STRING_ARRAY_TYPE,
(void) headerAddOrAppendEntry(h, RPMTAG_PROVIDEVERSION, RPM_STRING_ARRAY_TYPE,
&vdummy, 1);
headerAddOrAppendEntry(h, RPMTAG_PROVIDEFLAGS, RPM_INT32_TYPE,
(void) headerAddOrAppendEntry(h, RPMTAG_PROVIDEFLAGS, RPM_INT32_TYPE,
&fdummy, 1);
}
goto exit;
}
headerGetEntry(h, RPMTAG_PROVIDEFLAGS, NULL,
(void **) &provideFlags, NULL);
(void) hge(h, RPMTAG_PROVIDEFLAGS, NULL, (void **) &provideFlags, NULL);
for (i = 0; i < providesCount; i++) {
if (!(provideFlags[i] == RPMSENSE_EQUAL &&
@ -841,15 +842,15 @@ void providePackageNVR(Header h)
}
exit:
provides = headerFreeData(provides, -1);
providesEVR = headerFreeData(providesEVR, -1);
provides = hfd(provides, pnt);
providesEVR = hfd(providesEVR, pvt);
if (bingo) {
headerAddOrAppendEntry(h, RPMTAG_PROVIDENAME, RPM_STRING_ARRAY_TYPE,
(void) headerAddOrAppendEntry(h, RPMTAG_PROVIDENAME, RPM_STRING_ARRAY_TYPE,
&name, 1);
headerAddOrAppendEntry(h, RPMTAG_PROVIDEFLAGS, RPM_INT32_TYPE,
(void) headerAddOrAppendEntry(h, RPMTAG_PROVIDEFLAGS, RPM_INT32_TYPE,
&pFlags, 1);
headerAddOrAppendEntry(h, RPMTAG_PROVIDEVERSION, RPM_STRING_ARRAY_TYPE,
(void) headerAddOrAppendEntry(h, RPMTAG_PROVIDEVERSION, RPM_STRING_ARRAY_TYPE,
&pEVR, 1);
}
}

View File

@ -43,7 +43,7 @@ void headerMergeLegacySigs(Header h, const Header sig)
/*@notreached@*/ break;
}
if (!headerIsEntry(h, tag))
headerAddEntry(h, tag, type, ptr, count);
(void) headerAddEntry(h, tag, type, ptr, count);
}
headerFreeIterator(hi);
}
@ -72,7 +72,7 @@ Header headerRegenSigHeader(const Header h)
/*@notreached@*/ break;
}
if (!headerIsEntry(sig, stag))
headerAddEntry(sig, stag, type, ptr, count);
(void) headerAddEntry(sig, stag, type, ptr, count);
}
headerFreeIterator(hi);
return sig;
@ -103,7 +103,8 @@ static rpmRC readPackageHeaders(FD_t fd, /*@out@*/ struct rpmlead * leadPtr,
hdr = hdrPtr ? hdrPtr : &hdrBlock;
lead = leadPtr ? leadPtr : &leadBlock;
fstat(Fileno(fd), &sb);
memset(&sb, 0, sizeof(sb));
(void) fstat(Fileno(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 < sizeof(*lead)) return 1;
@ -141,9 +142,9 @@ static rpmRC readPackageHeaders(FD_t fd, /*@out@*/ struct rpmlead * leadPtr,
* anyone.
*/
if (headerIsEntry(*hdr, RPMTAG_FILEUSERNAME))
headerRemoveEntry(*hdr, RPMTAG_FILEUIDS);
(void) headerRemoveEntry(*hdr, RPMTAG_FILEUIDS);
if (headerIsEntry(*hdr, RPMTAG_FILEGROUPNAME))
headerRemoveEntry(*hdr, RPMTAG_FILEGIDS);
(void) headerRemoveEntry(*hdr, RPMTAG_FILEGIDS);
/*
* We switched the way we do relocateable packages. We fix some of
@ -155,7 +156,7 @@ static rpmRC readPackageHeaders(FD_t fd, /*@out@*/ struct rpmlead * leadPtr,
(void **) &defaultPrefix, NULL)) {
defaultPrefix =
stripTrailingChar(alloca_strdup(defaultPrefix), '/');
headerAddEntry(*hdr, RPMTAG_PREFIXES, RPM_STRING_ARRAY_TYPE,
(void) headerAddEntry(*hdr, RPMTAG_PREFIXES, RPM_STRING_ARRAY_TYPE,
&defaultPrefix, 1);
}
@ -171,7 +172,7 @@ static rpmRC readPackageHeaders(FD_t fd, /*@out@*/ struct rpmlead * leadPtr,
/* XXX binary rpms always have RPMTAG_SOURCERPM, source rpms do not */
if (lead->type == RPMLEAD_SOURCE) {
if (!headerIsEntry(*hdr, RPMTAG_SOURCEPACKAGE))
headerAddEntry(*hdr, RPMTAG_SOURCEPACKAGE, RPM_INT32_TYPE,
(void)headerAddEntry(*hdr, RPMTAG_SOURCEPACKAGE, RPM_INT32_TYPE,
&true, 1);
} else if (lead->major < 4) {
/* Retrofit "Provide: name = EVR" for binary packages. */

View File

@ -115,38 +115,42 @@ const char * rpmProblemString(rpmProblem prob) /*@*/
switch (prob->type) {
case RPMPROB_BADARCH:
snprintf(buf, nb, _("package %s is for a different architecture"),
(void) snprintf(buf, nb,
_("package %s is for a different architecture"),
prob->pkgNEVR);
break;
case RPMPROB_BADOS:
snprintf(buf, nb, _("package %s is for a different operating system"),
(void) snprintf(buf, nb,
_("package %s is for a different operating system"),
prob->pkgNEVR);
break;
case RPMPROB_PKG_INSTALLED:
snprintf(buf, nb, _("package %s is already installed"),
(void) snprintf(buf, nb,
_("package %s is already installed"),
prob->pkgNEVR);
break;
case RPMPROB_BADRELOCATE:
snprintf(buf, nb, _("path %s in package %s is not relocateable"),
(void) snprintf(buf, nb,
_("path %s in package %s is not relocateable"),
prob->str1, prob->pkgNEVR);
break;
case RPMPROB_NEW_FILE_CONFLICT:
snprintf(buf, nb,
(void) snprintf(buf, nb,
_("file %s conflicts between attempted installs of %s and %s"),
prob->str1, prob->pkgNEVR, prob->altNEVR);
break;
case RPMPROB_FILE_CONFLICT:
snprintf(buf, nb,
(void) snprintf(buf, nb,
_("file %s from install of %s conflicts with file from package %s"),
prob->str1, prob->pkgNEVR, prob->altNEVR);
break;
case RPMPROB_OLDPACKAGE:
snprintf(buf, nb,
(void) snprintf(buf, nb,
_("package %s (which is newer than %s) is already installed"),
prob->altNEVR, prob->pkgNEVR);
break;
case RPMPROB_DISKSPACE:
snprintf(buf, nb,
(void) snprintf(buf, nb,
_("installing package %s needs %ld%cb on the %s filesystem"),
prob->pkgNEVR,
prob->ulong1 > (1024*1024)
@ -156,19 +160,19 @@ const char * rpmProblemString(rpmProblem prob) /*@*/
prob->str1);
break;
case RPMPROB_DISKNODES:
snprintf(buf, nb,
(void) snprintf(buf, nb,
_("installing package %s needs %ld inodes on the %s filesystem"),
prob->pkgNEVR, (long)prob->ulong1, prob->str1);
break;
case RPMPROB_BADPRETRANS:
snprintf(buf, nb,
(void) snprintf(buf, nb,
_("package %s pre-transaction syscall(s): %s failed: %s"),
prob->pkgNEVR, prob->str1, strerror(prob->ulong1));
break;
case RPMPROB_REQUIRES:
case RPMPROB_CONFLICT:
default:
snprintf(buf, nb,
(void) snprintf(buf, nb,
_("unknown error %d encountered while manipulating package %s"),
prob->type, prob->pkgNEVR);
break;

168
lib/psm.c
View File

@ -48,15 +48,15 @@ int rpmVersionCompare(Header first, Header second)
return 1;
}
headerGetEntry(first, RPMTAG_VERSION, NULL, (void **) &one, NULL);
headerGetEntry(second, RPMTAG_VERSION, NULL, (void **) &two, NULL);
(void) headerGetEntry(first, RPMTAG_VERSION, NULL, (void **) &one, NULL);
(void) headerGetEntry(second, RPMTAG_VERSION, NULL, (void **) &two, NULL);
rc = rpmvercmp(one, two);
if (rc)
return rc;
headerGetEntry(first, RPMTAG_RELEASE, NULL, (void **) &one, NULL);
headerGetEntry(second, RPMTAG_RELEASE, NULL, (void **) &two, NULL);
(void) headerGetEntry(first, RPMTAG_RELEASE, NULL, (void **) &one, NULL);
(void) headerGetEntry(second, RPMTAG_RELEASE, NULL, (void **) &two, NULL);
return rpmvercmp(one, two);
}
@ -83,11 +83,11 @@ void loadFi(Header h, TFI_t fi)
if (h && fi->h == NULL) fi->h = headerLink(h);
/* Duplicate name-version-release so that headers can be free'd. */
hge(fi->h, RPMTAG_NAME, NULL, (void **) &fi->name, NULL);
rc = hge(fi->h, RPMTAG_NAME, NULL, (void **) &fi->name, NULL);
fi->name = xstrdup(fi->name);
hge(fi->h, RPMTAG_VERSION, NULL, (void **) &fi->version, NULL);
rc = hge(fi->h, RPMTAG_VERSION, NULL, (void **) &fi->version, NULL);
fi->version = xstrdup(fi->version);
hge(fi->h, RPMTAG_RELEASE, NULL, (void **) &fi->release, NULL);
rc = hge(fi->h, RPMTAG_RELEASE, NULL, (void **) &fi->release, NULL);
fi->release = xstrdup(fi->release);
/* -1 means not found */
@ -103,12 +103,12 @@ void loadFi(Header h, TFI_t fi)
return;
}
hge(fi->h, RPMTAG_DIRINDEXES, NULL, (void **) &fi->dil, NULL);
hge(fi->h, RPMTAG_DIRNAMES, NULL, (void **) &fi->dnl, &fi->dc);
hge(fi->h, RPMTAG_FILEMODES, NULL, (void **) &fi->fmodes, NULL);
hge(fi->h, RPMTAG_FILEFLAGS, NULL, (void **) &fi->fflags, NULL);
hge(fi->h, RPMTAG_FILESIZES, NULL, (void **) &fi->fsizes, NULL);
hge(fi->h, RPMTAG_FILESTATES, NULL, (void **) &fi->fstates, NULL);
rc = hge(fi->h, RPMTAG_DIRINDEXES, NULL, (void **) &fi->dil, NULL);
rc = hge(fi->h, RPMTAG_DIRNAMES, NULL, (void **) &fi->dnl, &fi->dc);
rc = hge(fi->h, RPMTAG_FILEMODES, NULL, (void **) &fi->fmodes, NULL);
rc = hge(fi->h, RPMTAG_FILEFLAGS, NULL, (void **) &fi->fflags, NULL);
rc = hge(fi->h, RPMTAG_FILESIZES, NULL, (void **) &fi->fsizes, NULL);
rc = hge(fi->h, RPMTAG_FILESTATES, NULL, (void **) &fi->fstates, NULL);
fi->action = FA_UNKNOWN;
fi->flags = 0;
@ -120,10 +120,10 @@ void loadFi(Header h, TFI_t fi)
switch (fi->type) {
case TR_ADDED:
fi->mapflags = CPIO_MAP_PATH | CPIO_MAP_MODE | CPIO_MAP_UID | CPIO_MAP_GID;
hge(fi->h, RPMTAG_FILEMD5S, NULL, (void **) &fi->fmd5s, NULL);
hge(fi->h, RPMTAG_FILELINKTOS, NULL, (void **) &fi->flinks, NULL);
hge(fi->h, RPMTAG_FILELANGS, NULL, (void **) &fi->flangs, NULL);
hge(fi->h, RPMTAG_FILEMTIMES, NULL, (void **) &fi->fmtimes, NULL);
rc = hge(fi->h, RPMTAG_FILEMD5S, NULL, (void **) &fi->fmd5s, NULL);
rc = hge(fi->h, RPMTAG_FILELINKTOS, NULL, (void **) &fi->flinks, NULL);
rc = hge(fi->h, RPMTAG_FILELANGS, NULL, (void **) &fi->flangs, NULL);
rc = hge(fi->h, RPMTAG_FILEMTIMES, NULL, (void **) &fi->fmtimes, NULL);
/* 0 makes for noops */
fi->replacedSizes = xcalloc(fi->fc, sizeof(*fi->replacedSizes));
@ -131,8 +131,8 @@ void loadFi(Header h, TFI_t fi)
break;
case TR_REMOVED:
fi->mapflags = CPIO_MAP_ABSOLUTE | CPIO_MAP_ADDDOT | CPIO_MAP_PATH | CPIO_MAP_MODE;
hge(fi->h, RPMTAG_FILEMD5S, NULL, (void **) &fi->fmd5s, NULL);
hge(fi->h, RPMTAG_FILELINKTOS, NULL, (void **) &fi->flinks, NULL);
rc = hge(fi->h, RPMTAG_FILEMD5S, NULL, (void **) &fi->fmd5s, NULL);
rc = hge(fi->h, RPMTAG_FILELINKTOS, NULL, (void **) &fi->flinks, NULL);
fi->fsizes = memcpy(xmalloc(fi->fc * sizeof(*fi->fsizes)),
fi->fsizes, fi->fc * sizeof(*fi->fsizes));
fi->fflags = memcpy(xmalloc(fi->fc * sizeof(*fi->fflags)),
@ -317,15 +317,15 @@ static int mergeFiles(TFI_t fi, Header h, Header newH)
RPMTAG_CONFLICTNAME, RPMTAG_CONFLICTVERSION, RPMTAG_CONFLICTFLAGS
};
hge(h, RPMTAG_SIZE, NULL, (void **) &fileSizes, NULL);
(void) hge(h, RPMTAG_SIZE, NULL, (void **) &fileSizes, NULL);
fileSize = *fileSizes;
hge(newH, RPMTAG_FILESIZES, NULL, (void **) &fileSizes, &count);
(void) hge(newH, RPMTAG_FILESIZES, NULL, (void **) &fileSizes, &count);
for (i = 0, fc = 0; i < count; i++)
if (actions[i] != FA_SKIPMULTILIB) {
fc++;
fileSize += fileSizes[i];
}
headerModifyEntry(h, RPMTAG_SIZE, RPM_INT32_TYPE, &fileSize, 1);
(void) headerModifyEntry(h, RPMTAG_SIZE, RPM_INT32_TYPE, &fileSize, 1);
for (i = 0; mergeTags[i]; i++) {
if (!hge(newH, mergeTags[i], &type, (void **) &data, &count))
@ -337,7 +337,7 @@ static int mergeFiles(TFI_t fi, Header h, Header newH)
for (j = 0, k = 0; j < count; j++)
if (actions[j] != FA_SKIPMULTILIB)
((int_8 *) newdata)[k++] = ((int_8 *) data)[j];
headerAddOrAppendEntry(h, mergeTags[i], type, newdata, fc);
(void) headerAddOrAppendEntry(h, mergeTags[i], type, newdata, fc);
free (newdata);
break;
case RPM_INT16_TYPE:
@ -345,7 +345,7 @@ static int mergeFiles(TFI_t fi, Header h, Header newH)
for (j = 0, k = 0; j < count; j++)
if (actions[j] != FA_SKIPMULTILIB)
((int_16 *) newdata)[k++] = ((int_16 *) data)[j];
headerAddOrAppendEntry(h, mergeTags[i], type, newdata, fc);
(void) headerAddOrAppendEntry(h, mergeTags[i], type, newdata, fc);
free (newdata);
break;
case RPM_INT32_TYPE:
@ -353,7 +353,7 @@ static int mergeFiles(TFI_t fi, Header h, Header newH)
for (j = 0, k = 0; j < count; j++)
if (actions[j] != FA_SKIPMULTILIB)
((int_32 *) newdata)[k++] = ((int_32 *) data)[j];
headerAddOrAppendEntry(h, mergeTags[i], type, newdata, fc);
(void) headerAddOrAppendEntry(h, mergeTags[i], type, newdata, fc);
free (newdata);
break;
case RPM_STRING_ARRAY_TYPE:
@ -361,7 +361,7 @@ static int mergeFiles(TFI_t fi, Header h, Header newH)
for (j = 0, k = 0; j < count; j++)
if (actions[j] != FA_SKIPMULTILIB)
((char **) newdata)[k++] = ((char **) data)[j];
headerAddOrAppendEntry(h, mergeTags[i], type, newdata, fc);
(void) headerAddOrAppendEntry(h, mergeTags[i], type, newdata, fc);
free (newdata);
break;
default:
@ -372,10 +372,10 @@ static int mergeFiles(TFI_t fi, Header h, Header newH)
}
data = hfd(data, type);
}
hge(newH, RPMTAG_DIRINDEXES, NULL, (void **) &newDirIndexes, &count);
hge(newH, RPMTAG_DIRNAMES, NULL, (void **) &newDirNames, NULL);
hge(h, RPMTAG_DIRINDEXES, NULL, (void **) &dirIndexes, NULL);
hge(h, RPMTAG_DIRNAMES, NULL, (void **) &data, &dirNamesCount);
(void) hge(newH, RPMTAG_DIRINDEXES, NULL, (void **) &newDirIndexes, &count);
(void) hge(newH, RPMTAG_DIRNAMES, NULL, (void **) &newDirNames, NULL);
(void) hge(h, RPMTAG_DIRINDEXES, NULL, (void **) &dirIndexes, NULL);
(void) hge(h, RPMTAG_DIRNAMES, NULL, (void **) &data, &dirNamesCount);
dirNames = xcalloc(dirNamesCount + fc, sizeof(char *));
for (i = 0; i < dirNamesCount; i++)
@ -392,9 +392,9 @@ static int mergeFiles(TFI_t fi, Header h, Header newH)
dirNames[dirCount++] = newDirNames[newDirIndexes[i]];
((int_32 *) newdata)[k++] = j;
}
headerAddOrAppendEntry(h, RPMTAG_DIRINDEXES, RPM_INT32_TYPE, newdata, fc);
(void) headerAddOrAppendEntry(h, RPMTAG_DIRINDEXES, RPM_INT32_TYPE, newdata, fc);
if (dirCount > dirNamesCount)
headerAddOrAppendEntry(h, RPMTAG_DIRNAMES, RPM_STRING_ARRAY_TYPE,
(void) headerAddOrAppendEntry(h, RPMTAG_DIRNAMES, RPM_STRING_ARRAY_TYPE,
dirNames + dirNamesCount,
dirCount - dirNamesCount);
data = hfd(data, -1);
@ -411,12 +411,12 @@ static int mergeFiles(TFI_t fi, Header h, Header newH)
if (!hge(newH, requireTags[i], &nnt, (void **) &newNames, &newCount))
continue;
hge(newH, requireTags[i+1], &nvt, (void **) &newEVR, NULL);
hge(newH, requireTags[i+2], NULL, (void **) &newFlags, NULL);
(void) hge(newH, requireTags[i+1], &nvt, (void **) &newEVR, NULL);
(void) hge(newH, requireTags[i+2], NULL, (void **) &newFlags, NULL);
if (hge(h, requireTags[i], &rnt, (void **) &Names, &Count))
{
hge(h, requireTags[i+1], NULL, (void **) &EVR, NULL);
hge(h, requireTags[i+2], NULL, (void **) &Flags, NULL);
(void) hge(h, requireTags[i+1], NULL, (void **) &EVR, NULL);
(void) hge(h, requireTags[i+2], NULL, (void **) &Flags, NULL);
for (j = 0; j < newCount; j++)
for (k = 0; k < Count; k++)
if (!strcmp (newNames[j], Names[k])
@ -439,11 +439,11 @@ static int mergeFiles(TFI_t fi, Header h, Header newH)
k++;
}
if (k) {
headerAddOrAppendEntry(h, requireTags[i],
(void) headerAddOrAppendEntry(h, requireTags[i],
RPM_STRING_ARRAY_TYPE, newNames, k);
headerAddOrAppendEntry(h, requireTags[i+1],
(void) headerAddOrAppendEntry(h, requireTags[i+1],
RPM_STRING_ARRAY_TYPE, newEVR, k);
headerAddOrAppendEntry(h, requireTags[i+2], RPM_INT32_TYPE,
(void) headerAddOrAppendEntry(h, requireTags[i+2], RPM_INT32_TYPE,
newFlags, k);
}
newNames = hfd(newNames, nnt);
@ -494,7 +494,7 @@ static int markReplacedFiles(PSM_t psm)
}
mi = rpmdbInitIterator(ts->rpmdb, RPMDBI_PACKAGES, NULL, 0);
rpmdbAppendIterator(mi, offsets, num);
(void) rpmdbAppendIterator(mi, offsets, num);
sfi = replaced;
while ((h = rpmdbNextIterator(mi)) != NULL) {
@ -516,7 +516,7 @@ static int markReplacedFiles(PSM_t psm)
if (modified == 0) {
/* Modified header will be rewritten. */
modified = 1;
rpmdbSetIteratorModified(mi, modified);
(void) rpmdbSetIteratorModified(mi, modified);
}
num++;
}
@ -610,7 +610,7 @@ rpmRC rpmInstallSourcePackage(const char * rootDir, FD_t fd,
headerFree(h); /* XXX reference held by transaction set */
h = NULL;
rpmInstallLoadMacros(fi, fi->h);
(void) rpmInstallLoadMacros(fi, fi->h);
memset(psm, 0, sizeof(*psm));
psm->ts = ts;
@ -812,7 +812,7 @@ static int runScript(PSM_t psm, Header h,
argc = progArgc;
}
headerNVR(h, &n, &v, &r);
(void) headerNVR(h, &n, &v, &r);
if (hge(h, RPMTAG_INSTPREFIXES, &ipt, (void **) &prefixes, &numPrefixes)) {
freePrefixes = 1;
} else if (hge(h, RPMTAG_INSTALLPREFIX, NULL, (void **) &oldPrefix, NULL)) {
@ -838,10 +838,10 @@ static int runScript(PSM_t psm, Header h,
if (rpmIsDebug() &&
(!strcmp(argv[0], "/bin/sh") || !strcmp(argv[0], "/bin/bash")))
(void)Fwrite("set -x\n", sizeof(char), 7, fd);
(void) Fwrite("set -x\n", sizeof(char), 7, fd);
(void)Fwrite(script, sizeof(script[0]), strlen(script), fd);
Fclose(fd);
(void) Fwrite(script, sizeof(script[0]), strlen(script), fd);
(void) Fclose(fd);
{ const char * sn = fn;
if (!ts->chrootDone &&
@ -886,22 +886,22 @@ static int runScript(PSM_t psm, Header h,
pipes[0] = pipes[1] = 0;
/* make stdin inaccessible */
pipe(pipes);
close(pipes[1]);
dup2(pipes[0], STDIN_FILENO);
close(pipes[0]);
(void) pipe(pipes);
(void) close(pipes[1]);
(void) dup2(pipes[0], STDIN_FILENO);
(void) close(pipes[0]);
if (ts->scriptFd != NULL) {
if (Fileno(ts->scriptFd) != STDERR_FILENO)
dup2(Fileno(ts->scriptFd), STDERR_FILENO);
(void) dup2(Fileno(ts->scriptFd), STDERR_FILENO);
if (Fileno(out) != STDOUT_FILENO)
dup2(Fileno(out), STDOUT_FILENO);
(void) dup2(Fileno(out), STDOUT_FILENO);
/* make sure we don't close stdin/stderr/stdout by mistake! */
if (Fileno(out) > STDERR_FILENO && Fileno(out) != Fileno(ts->scriptFd)) {
Fclose (out);
(void) Fclose (out);
}
if (Fileno(ts->scriptFd) > STDERR_FILENO) {
Fclose (ts->scriptFd);
(void) Fclose (ts->scriptFd);
}
}
@ -910,18 +910,18 @@ static int runScript(PSM_t psm, Header h,
if (ipath && ipath[5] != '%')
path = ipath;
doputenv(path);
(void) doputenv(path);
ipath = _free(ipath);
}
for (i = 0; i < numPrefixes; i++) {
sprintf(prefixBuf, "RPM_INSTALL_PREFIX%d=%s", i, prefixes[i]);
doputenv(prefixBuf);
(void) doputenv(prefixBuf);
/* backwards compatibility */
if (i == 0) {
sprintf(prefixBuf, "RPM_INSTALL_PREFIX=%s", prefixes[i]);
doputenv(prefixBuf);
(void) doputenv(prefixBuf);
}
}
@ -935,8 +935,8 @@ static int runScript(PSM_t psm, Header h,
if (!ts->chrootDone && !(rootDir[0] == '/' && rootDir[1] == '\0')) {
/*@-unrecog@*/ chroot(rootDir); /*@=unrecog@*/
}
chdir("/");
execv(argv[0], (char *const *)argv);
(void) chdir("/");
(void) execv(argv[0], (char *const *)argv);
break;
default:
break;
@ -963,10 +963,11 @@ static int runScript(PSM_t psm, Header h,
if (freePrefixes) prefixes = hfd(prefixes, ipt);
Fclose(out); /* XXX dup'd STDOUT_FILENO */
(void) Fclose(out); /* XXX dup'd STDOUT_FILENO */
if (script) {
if (!rpmIsDebug()) unlink(fn);
if (!rpmIsDebug())
(void) unlink(fn);
fn = _free(fn);
}
@ -994,8 +995,8 @@ static rpmRC runInstScript(PSM_t psm)
* headerGetEntry() sets the data pointer to NULL if the entry does
* not exist.
*/
hge(fi->h, psm->progTag, &ptt, (void **) &programArgv, &programArgc);
hge(fi->h, psm->scriptTag, &stt, (void **) &script, NULL);
(void) hge(fi->h, psm->progTag, &ptt, (void **) &programArgv, &programArgc);
(void) hge(fi->h, psm->scriptTag, &stt, (void **) &script, NULL);
if (programArgv && ptt == RPM_STRING_TYPE) {
argv = alloca(sizeof(char *));
@ -1045,10 +1046,10 @@ static int handleOneTrigger(PSM_t psm, Header sourceH, Header triggeredH,
(void **) &triggerNames, &numTriggers))
return 0;
headerNVR(sourceH, &sourceName, NULL, NULL);
(void) headerNVR(sourceH, &sourceName, NULL, NULL);
hge(triggeredH, RPMTAG_TRIGGERFLAGS, &tft, (void **) &triggerFlags, NULL);
hge(triggeredH, RPMTAG_TRIGGERVERSION, &tvt, (void **) &triggerEVR, NULL);
(void) hge(triggeredH, RPMTAG_TRIGGERFLAGS, &tft, (void **) &triggerFlags, NULL);
(void) hge(triggeredH, RPMTAG_TRIGGERVERSION, &tvt, (void **) &triggerEVR, NULL);
for (i = 0; i < numTriggers; i++) {
int_32 tit, tst, tpt;
@ -1073,14 +1074,14 @@ static int handleOneTrigger(PSM_t psm, Header sourceH, Header triggeredH,
triggerEVR[i] + skip, triggerFlags[i]))
continue;
hge(triggeredH, RPMTAG_TRIGGERINDEX, &tit,
(void) hge(triggeredH, RPMTAG_TRIGGERINDEX, &tit,
(void **) &triggerIndices, NULL);
hge(triggeredH, RPMTAG_TRIGGERSCRIPTS, &tst,
(void) hge(triggeredH, RPMTAG_TRIGGERSCRIPTS, &tst,
(void **) &triggerScripts, NULL);
hge(triggeredH, RPMTAG_TRIGGERSCRIPTPROG, &tpt,
(void) hge(triggeredH, RPMTAG_TRIGGERSCRIPTPROG, &tpt,
(void **) &triggerProgs, NULL);
headerNVR(triggeredH, &triggerPackageName, NULL, NULL);
(void) headerNVR(triggeredH, &triggerPackageName, NULL, NULL);
{ int arg1;
int index;
@ -1178,7 +1179,7 @@ static int runImmedTriggers(PSM_t psm)
(void **) &triggerNames, &numTriggers))
return 0;
hge(fi->h, RPMTAG_TRIGGERINDEX, &tit, (void **) &triggerIndices,
(void) hge(fi->h, RPMTAG_TRIGGERINDEX, &tit, (void **) &triggerIndices,
&numTriggerIndices);
triggersRun = alloca(sizeof(*triggersRun) * numTriggerIndices);
memset(triggersRun, 0, sizeof(*triggersRun) * numTriggerIndices);
@ -1321,10 +1322,10 @@ assert(psm->mi == NULL);
rpmBuildFileList(fi->h, &fi->apath, NULL);
if (fi->fuser == NULL)
hge(fi->h, RPMTAG_FILEUSERNAME, NULL,
(void) hge(fi->h, RPMTAG_FILEUSERNAME, NULL,
(void **) &fi->fuser, NULL);
if (fi->fgroup == NULL)
hge(fi->h, RPMTAG_FILEGROUPNAME, NULL,
(void) hge(fi->h, RPMTAG_FILEGROUPNAME, NULL,
(void **) &fi->fgroup, NULL);
if (fi->fuids == NULL)
fi->fuids = xcalloc(sizeof(*fi->fuids), fi->fc);
@ -1511,7 +1512,7 @@ assert(psm->mi == NULL);
(void) fsmTeardown(fi->fsm);
saveerrno = errno; /* XXX FIXME: Fclose with libio destroys errno */
Fclose(psm->cfd);
(void) Fclose(psm->cfd);
psm->cfd = NULL;
errno = saveerrno; /* XXX FIXME: Fclose with libio destroys errno */
@ -1560,7 +1561,7 @@ assert(psm->mi == NULL);
fi->action = FA_COPYOUT;
fi->actions = NULL;
Fflush(psm->fd);
(void) Fflush(psm->fd);
psm->cfd = Fdopen(fdDup(Fileno(psm->fd)), psm->rpmio_flags);
/* XXX failedFile? */
@ -1568,7 +1569,7 @@ assert(psm->mi == NULL);
(void) fsmTeardown(fi->fsm);
saveerrno = errno; /* XXX FIXME: Fclose with libio destroys errno */
Fclose(psm->cfd);
(void) Fclose(psm->cfd);
psm->cfd = NULL;
errno = saveerrno;
@ -1583,20 +1584,21 @@ assert(psm->mi == NULL);
int_32 installTime = time(NULL);
if (fi->fc > 0 && fi->fstates)
headerAddEntry(fi->h, RPMTAG_FILESTATES, RPM_CHAR_TYPE,
(void) headerAddEntry(fi->h, RPMTAG_FILESTATES, RPM_CHAR_TYPE,
fi->fstates, fi->fc);
headerAddEntry(fi->h, RPMTAG_INSTALLTIME, RPM_INT32_TYPE,
(void) headerAddEntry(fi->h, RPMTAG_INSTALLTIME, RPM_INT32_TYPE,
&installTime, 1);
if (ts->transFlags & RPMTRANS_FLAG_MULTILIB) {
uint_32 multiLib, * newMultiLib, * p;
if (hge(fi->h, RPMTAG_MULTILIBS, NULL, (void **) &newMultiLib, NULL) &&
hge(psm->oh, RPMTAG_MULTILIBS, NULL, (void **) &p, NULL)) {
hge(psm->oh, RPMTAG_MULTILIBS, NULL, (void **) &p, NULL))
{
multiLib = *p;
multiLib |= *newMultiLib;
headerModifyEntry(psm->oh, RPMTAG_MULTILIBS, RPM_INT32_TYPE,
(void) headerModifyEntry(psm->oh, RPMTAG_MULTILIBS, RPM_INT32_TYPE,
&multiLib, 1);
}
rc = mergeFiles(fi, psm->oh, fi->h);
@ -1674,7 +1676,7 @@ assert(psm->mi == NULL);
if (psm->fd) {
saveerrno = errno; /* XXX FIXME: Fclose with libio destroys errno */
Fclose(psm->fd);
(void) Fclose(psm->fd);
psm->fd = NULL;
errno = saveerrno;
}
@ -1754,7 +1756,7 @@ assert(psm->mi == NULL);
_loaded++;
}
chdir("/");
(void) chdir("/");
/*@-unrecog@*/
rc = chroot(ts->rootDir);
/*@=unrecog@*/
@ -1768,7 +1770,7 @@ assert(psm->mi == NULL);
rc = chroot(".");
/*@=unrecog@*/
psm->chrootDone = ts->chrootDone = 0;
chdir(ts->currDir);
(void) chdir(ts->currDir);
}
break;
case PSM_SCRIPT:

View File

@ -136,6 +136,8 @@ static int countLinks(int_16 * fileRdevList, int_32 * fileInodeList, int nfiles,
int showQueryPackage(QVA_t *qva, /*@unused@*/rpmdb rpmdb, Header h)
{
HGE_t hge = (HGE_t)headerGetEntryMinMemory;
HFD_t hfd = headerFreeData;
char * t, * te;
int queryFlags = qva->qva_flags;
@ -145,6 +147,7 @@ int showQueryPackage(QVA_t *qva, /*@unused@*/rpmdb rpmdb, Header h)
char * prefix = NULL;
const char ** dirNames = NULL;
const char ** baseNames = NULL;
int bnt, dnt;
const char ** fileMD5List = NULL;
const char ** fileOwnerList = NULL;
const char ** fileGroupList = NULL;
@ -166,7 +169,7 @@ int showQueryPackage(QVA_t *qva, /*@unused@*/rpmdb rpmdb, Header h)
if (!queryFormat && !queryFlags) {
const char * name, * version, * release;
headerNVR(h, &name, &version, &release);
(void) headerNVR(h, &name, &version, &release);
te = stpcpy(te, name);
te = stpcpy( stpcpy(te, "-"), version);
te = stpcpy( stpcpy(te, "-"), release);
@ -194,39 +197,35 @@ int showQueryPackage(QVA_t *qva, /*@unused@*/rpmdb rpmdb, Header h)
if (!(queryFlags & QUERY_FOR_LIST))
goto exit;
if (!headerGetEntry(h, RPMTAG_BASENAMES, &type,
(void **) &baseNames, &count)) {
if (!hge(h, RPMTAG_BASENAMES, &bnt, (void **) &baseNames, &count)) {
te = stpcpy(te, _("(contains no files)"));
goto exit;
}
if (!headerGetEntry(h, RPMTAG_FILESTATES, &type,
(void **) &fileStatesList, &count)) {
if (!hge(h, RPMTAG_FILESTATES, &type, (void **) &fileStatesList, &count)) {
fileStatesList = NULL;
}
headerGetEntry(h, RPMTAG_DIRNAMES, NULL, (void **) &dirNames, NULL);
headerGetEntry(h, RPMTAG_DIRINDEXES, NULL, (void **) &dirIndexes, NULL);
headerGetEntry(h, RPMTAG_FILEFLAGS, &type, (void **)&fileFlagsList, &count);
headerGetEntry(h, RPMTAG_FILESIZES, &type, (void **) &fileSizeList, &count);
headerGetEntry(h, RPMTAG_FILEMODES, &type, (void **) &fileModeList, &count);
headerGetEntry(h, RPMTAG_FILEMTIMES, &type, (void **)&fileMTimeList,&count);
headerGetEntry(h, RPMTAG_FILERDEVS, &type, (void **) &fileRdevList, &count);
headerGetEntry(h, RPMTAG_FILEINODES, &type, (void **)&fileInodeList,&count);
headerGetEntry(h, RPMTAG_FILELINKTOS,&type,(void **)&fileLinktoList,&count);
headerGetEntry(h, RPMTAG_FILEMD5S, &type, (void **) &fileMD5List, &count);
(void) hge(h, RPMTAG_DIRNAMES, &dnt, (void **) &dirNames, NULL);
(void) hge(h, RPMTAG_DIRINDEXES, NULL, (void **) &dirIndexes, NULL);
(void) hge(h, RPMTAG_FILEFLAGS, &type, (void **)&fileFlagsList, &count);
(void) hge(h, RPMTAG_FILESIZES, &type, (void **) &fileSizeList, &count);
(void) hge(h, RPMTAG_FILEMODES, &type, (void **) &fileModeList, &count);
(void) hge(h, RPMTAG_FILEMTIMES, &type, (void **)&fileMTimeList,&count);
(void) hge(h, RPMTAG_FILERDEVS, &type, (void **) &fileRdevList, &count);
(void) hge(h, RPMTAG_FILEINODES, &type, (void **)&fileInodeList,&count);
(void) hge(h, RPMTAG_FILELINKTOS,&type,(void **)&fileLinktoList,&count);
(void) hge(h, RPMTAG_FILEMD5S, &type, (void **) &fileMD5List, &count);
if (!headerGetEntry(h, RPMTAG_FILEUIDS, &type,
(void **) &fileUIDList, &count)) {
if (!hge(h, RPMTAG_FILEUIDS, &type, (void **) &fileUIDList, &count)) {
fileUIDList = NULL;
} else if (!headerGetEntry(h, RPMTAG_FILEGIDS, &type,
} else if (!hge(h, RPMTAG_FILEGIDS, &type,
(void **) &fileGIDList, &count)) {
fileGIDList = NULL;
}
if (!headerGetEntry(h, RPMTAG_FILEUSERNAME, &type,
(void **) &fileOwnerList, &count)) {
if (!hge(h, RPMTAG_FILEUSERNAME, &type, (void **) &fileOwnerList, &count)) {
fileOwnerList = NULL;
} else if (!headerGetEntry(h, RPMTAG_FILEGROUPNAME, &type,
(void **) &fileGroupList, &count)) {
} else
if (!hge(h, RPMTAG_FILEGROUPNAME, &type, (void **) &fileGroupList, &count)) {
fileGroupList = NULL;
}
@ -349,12 +348,12 @@ exit:
rpmMessage(RPMMESS_NORMAL, "%s", t);
}
t = _free(t);
dirNames = headerFreeData(dirNames, -1);
baseNames = headerFreeData(baseNames, -1);
fileLinktoList = headerFreeData(fileLinktoList, -1);
fileMD5List = headerFreeData(fileMD5List, -1);
fileOwnerList = headerFreeData(fileOwnerList, -1);
fileGroupList = headerFreeData(fileGroupList, -1);
dirNames = hfd(dirNames, dnt);
baseNames = hfd(baseNames, bnt);
fileLinktoList = hfd(fileLinktoList, -1);
fileMD5List = hfd(fileMD5List, -1);
fileOwnerList = hfd(fileOwnerList, -1);
fileGroupList = hfd(fileGroupList, -1);
return rc;
}
@ -511,13 +510,13 @@ restart:
if (fd == NULL || Ferror(fd)) {
rpmError(RPMERR_OPEN, _("open of %s failed: %s\n"), fileURL,
Fstrerror(fd));
if (fd) Fclose(fd);
if (fd) (void) Fclose(fd);
retcode = 1;
break;
}
rpmrc = rpmReadPackageHeader(fd, &h, &isSource, NULL, NULL);
Fclose(fd);
(void) Fclose(fd);
if (!(rpmrc == RPMRC_OK || rpmrc == RPMRC_BADMAGIC)) {
rpmError(RPMERR_QUERY, _("query of %s failed\n"), fileURL);
@ -543,7 +542,7 @@ restart:
if (fd == NULL || Ferror(fd)) {
rpmError(RPMERR_OPEN, _("open of %s failed: %s\n"), fileURL,
Fstrerror(fd));
if (fd) Fclose(fd);
if (fd) (void) Fclose(fd);
retcode = 1;
break;
}
@ -555,7 +554,7 @@ restart:
fileURL, Fstrerror(fd));
retcode = 1;
}
Fclose(fd);
(void) Fclose(fd);
/* If successful, restart the query loop. */
if (retcode == 0)
@ -608,7 +607,7 @@ restart:
}
for (pkg = spec->packages; pkg != NULL; pkg = pkg->next) {
showPackage(qva, NULL, pkg->header);
(void) showPackage(qva, NULL, pkg->header);
}
freeSpecVec(spec);
} break;
@ -768,7 +767,7 @@ int rpmQuery(QVA_t *qva, rpmQVSources source, const char * arg)
rc = rpmQueryVerify(qva, source, arg, rpmdb, showQueryPackage);
if (rpmdb != NULL)
rpmdbClose(rpmdb);
(void) rpmdbClose(rpmdb);
return rc;
}

View File

@ -27,7 +27,7 @@ static int manageFile(FD_t *fdp, const char **fnp, int flags,
/* close and reset *fdp to NULL */
if (*fdp && (fnp == NULL || *fnp == NULL)) {
Fclose(*fdp);
(void) Fclose(*fdp);
*fdp = NULL;
return 0;
}
@ -94,8 +94,8 @@ static int copyFile(FD_t *sfdp, const char **sfnp,
rc = 0;
exit:
if (*sfdp) manageFile(sfdp, NULL, 0, rc);
if (*tfdp) manageFile(tfdp, NULL, 0, rc);
if (*sfdp) (void) manageFile(sfdp, NULL, 0, rc);
if (*tfdp) (void) manageFile(tfdp, NULL, 0, rc);
return rc;
}
@ -159,12 +159,12 @@ int rpmReSign(rpmResignFlags add, char *passPhrase, const char **argv)
if (add != RESIGN_ADD_SIGNATURE) {
rpmFreeSignature(sig);
sig = rpmNewSignature();
rpmAddSignature(sig, sigtarget, RPMSIGTAG_SIZE, passPhrase);
rpmAddSignature(sig, sigtarget, RPMSIGTAG_MD5, passPhrase);
(void) rpmAddSignature(sig, sigtarget, RPMSIGTAG_SIZE, passPhrase);
(void) rpmAddSignature(sig, sigtarget, RPMSIGTAG_MD5, passPhrase);
}
if ((sigtype = rpmLookupSignatureType(RPMLOOKUPSIG_QUERY)) > 0)
rpmAddSignature(sig, sigtarget, sigtype, passPhrase);
(void) rpmAddSignature(sig, sigtarget, sigtype, passPhrase);
/* Write the lead/signature of the output rpm */
strcpy(tmprpm, rpm);
@ -196,30 +196,31 @@ int rpmReSign(rpmResignFlags add, char *passPhrase, const char **argv)
/* ASSERT: fd == NULL && ofd == NULL */
/* Clean up intermediate target */
unlink(sigtarget);
(void) unlink(sigtarget);
sigtarget = _free(sigtarget);
/* Move final target into place. */
unlink(rpm);
rename(trpm, rpm); tmprpm[0] = '\0';
(void) unlink(rpm);
(void) rename(trpm, rpm);
tmprpm[0] = '\0';
}
res = 0;
exit:
if (fd) manageFile(&fd, NULL, 0, res);
if (ofd) manageFile(&ofd, NULL, 0, res);
if (fd) (void) manageFile(&fd, NULL, 0, res);
if (ofd) (void) manageFile(&ofd, NULL, 0, res);
if (sig) {
rpmFreeSignature(sig);
sig = NULL;
}
if (sigtarget) {
unlink(sigtarget);
(void) unlink(sigtarget);
sigtarget = _free(sigtarget);
}
if (tmprpm[0] != '\0') {
unlink(tmprpm);
(void) unlink(tmprpm);
tmprpm[0] = '\0';
}
@ -422,7 +423,7 @@ int rpmCheckSig(rpmCheckSigFlags flags, const char **argv)
}
headerFreeIterator(hi);
res += res2;
unlink(sigtarget);
(void) unlink(sigtarget);
sigtarget = _free(sigtarget);
if (res2) {
@ -455,10 +456,10 @@ int rpmCheckSig(rpmCheckSigFlags flags, const char **argv)
}
bottom:
if (fd) manageFile(&fd, NULL, 0, 0);
if (ofd) manageFile(&ofd, NULL, 0, 0);
if (fd) (void) manageFile(&fd, NULL, 0, 0);
if (ofd) (void) manageFile(&ofd, NULL, 0, 0);
if (sigtarget) {
unlink(sigtarget);
(void) unlink(sigtarget);
sigtarget = _free(sigtarget);
}
}

View File

@ -630,8 +630,8 @@ static void blockSignals(rpmdb rpmdb, /*@out@*/ sigset_t * oldMask)
/* XXX HACK (disabled) permit ^C aborts for now ... */
if (!(rpmdb && rpmdb->db_api == 4)) {
sigfillset(&newMask); /* block all signals */
sigprocmask(SIG_BLOCK, &newMask, oldMask);
(void) sigfillset(&newMask); /* block all signals */
(void) sigprocmask(SIG_BLOCK, &newMask, oldMask);
}
}
@ -642,7 +642,7 @@ static void unblockSignals(rpmdb rpmdb, sigset_t * oldMask)
{
/* XXX HACK (disabled) permit ^C aborts for now ... */
if (!(rpmdb && rpmdb->db_api == 4)) {
sigprocmask(SIG_SETMASK, oldMask, NULL);
(void) sigprocmask(SIG_SETMASK, oldMask, NULL);
}
}
@ -685,7 +685,7 @@ int rpmdbClose (rpmdb rpmdb)
if (rpmdb->_dbi[dbix] == NULL)
continue;
/*@-unqualifiedtrans@*/
dbiClose(rpmdb->_dbi[dbix], 0);
(void) dbiClose(rpmdb->_dbi[dbix], 0);
rpmdb->_dbi[dbix] = NULL;
/*@=unqualifiedtrans@*/
}
@ -735,7 +735,7 @@ static /*@only@*/ rpmdb newRpmdb(/*@kept@*/ const char * root,
rpmdb->db_home = rpmGetPath( (home && *home ? home : _DB_HOME), NULL);
if (!(rpmdb->db_home && rpmdb->db_home[0] != '%')) {
rpmError(RPMERR_DBOPEN, _("no dbpath has been set\n"));
rpmdbClose(rpmdb);
(void) rpmdbClose(rpmdb);
/*@-globstate@*/ return NULL; /*@=globstate@*/
}
rpmdb->db_errpfx = rpmExpand( (epfx && *epfx ? epfx : _DB_ERRPFX), NULL);
@ -844,7 +844,7 @@ static int openDatabase(const char * prefix, const char * dbpath, int _dbapi,
exit:
if (rc || justCheck || dbp == NULL)
rpmdbClose(rpmdb);
(void) rpmdbClose(rpmdb);
else
*dbp = rpmdb;
@ -867,8 +867,8 @@ int rpmdbInit (const char * prefix, int perms)
rc = openDatabase(prefix, NULL, _dbapi, &rpmdb, (O_CREAT | O_RDWR),
perms, RPMDB_FLAG_JUSTCHECK);
if (rpmdb) {
rpmdbOpenAll(rpmdb);
rpmdbClose(rpmdb);
(void) rpmdbOpenAll(rpmdb);
(void) rpmdbClose(rpmdb);
rpmdb = NULL;
}
return rc;
@ -946,9 +946,9 @@ static int rpmdbFindByFile(rpmdb rpmdb, const char * filespec,
continue;
}
hge(h, RPMTAG_BASENAMES, &bnt, (void **) &baseNames, NULL);
hge(h, RPMTAG_DIRNAMES, &dnt, (void **) &dirNames, NULL);
hge(h, RPMTAG_DIRINDEXES, NULL, (void **) &dirIndexes, NULL);
(void) hge(h, RPMTAG_BASENAMES, &bnt, (void **) &baseNames, NULL);
(void) hge(h, RPMTAG_DIRNAMES, &dnt, (void **) &dirNames, NULL);
(void) hge(h, RPMTAG_DIRINDEXES, NULL, (void **) &dirIndexes, NULL);
do {
fingerPrint fp2;
@ -958,7 +958,7 @@ static int rpmdbFindByFile(rpmdb rpmdb, const char * filespec,
if (FP_EQUAL(fp1, fp2)) {
rec->hdrNum = dbiIndexRecordOffset(allMatches, i);
rec->tagNum = dbiIndexRecordFileNumber(allMatches, i);
dbiAppendSet(*matches, rec, 1, sizeof(*rec), 0);
(void) dbiAppendSet(*matches, rec, 1, sizeof(*rec), 0);
}
prevoff = offset;
@ -1071,7 +1071,7 @@ static int dbiFindMatches(dbiIndex dbi, DBC * dbcursor,
goto exit;
}
headerNVR(h, NULL, &pkgVersion, &pkgRelease);
(void) headerNVR(h, NULL, &pkgVersion, &pkgRelease);
goodRelease = goodVersion = 1;
@ -1200,8 +1200,8 @@ struct _rpmdbMatchIterator {
unsigned int mi_filenum;
unsigned int mi_fpnum;
unsigned int mi_dbnum;
/*@only@*/ const char *mi_version;
/*@only@*/ const char *mi_release;
/*@only@*/ const char * mi_version;
/*@only@*/ const char * mi_release;
};
rpmdbMatchIterator rpmdbFreeIterator(rpmdbMatchIterator mi)
@ -1217,7 +1217,7 @@ rpmdbMatchIterator rpmdbFreeIterator(rpmdbMatchIterator mi)
if (mi->mi_modified && mi->mi_prevoffset) {
DBC * dbcursor = NULL;
xx = dbiCopen(dbi, &dbcursor, 0);
dbiUpdateRecord(dbi, dbcursor, mi->mi_prevoffset, mi->mi_h);
(void) dbiUpdateRecord(dbi, dbcursor, mi->mi_prevoffset, mi->mi_h);
xx = dbiCclose(dbi, dbcursor, 0);
dbcursor = NULL;
}
@ -1328,6 +1328,13 @@ top:
keylen = mi->mi_keylen;
rc = dbiGet(dbi, mi->mi_dbc, &keyp, &keylen, &uh, &uhlen, 0);
if (dbi->dbi_api == 1 && dbi->dbi_rpmtag == RPMDBI_PACKAGES && rc == EFAULT) {
rpmError(RPMERR_INTERNAL,
_("record number %u in database is bad -- skipping.\n"), dbi->dbi_lastoffset);
if (keyp && dbi->dbi_lastoffset)
memcpy(&mi->mi_offset, keyp, sizeof(mi->mi_offset));
continue;
}
/*
* If we got the next key, save the header instance number.
@ -1359,23 +1366,25 @@ top:
/* Free current header */
if (mi->mi_h) {
if (mi->mi_modified && mi->mi_prevoffset)
dbiUpdateRecord(dbi, mi->mi_dbc, mi->mi_prevoffset, mi->mi_h);
(void) dbiUpdateRecord(dbi, mi->mi_dbc, mi->mi_prevoffset, mi->mi_h);
headerFree(mi->mi_h);
mi->mi_h = NULL;
}
mi->mi_h = headerCopyLoad(uh);
/* XXX db1 with hybrid, simulated db interface on falloc.c needs free. */
if (dbi->dbi_api <= 1) free(uh);
if (mi->mi_release) {
const char *release;
headerNVR(mi->mi_h, NULL, NULL, &release);
(void) headerNVR(mi->mi_h, NULL, NULL, &release);
if (strcmp(mi->mi_release, release))
goto top;
}
if (mi->mi_version) {
const char *version;
headerNVR(mi->mi_h, NULL, &version, NULL);
(void) headerNVR(mi->mi_h, NULL, &version, NULL);
if (strcmp(mi->mi_version, version))
goto top;
}
@ -1456,7 +1465,7 @@ int rpmdbPruneIterator(rpmdbMatchIterator mi, int * hdrNums,
return 1;
if (mi->mi_set)
dbiPruneSet(mi->mi_set, hdrNums, nHdrNums, sizeof(*hdrNums), sorted);
(void) dbiPruneSet(mi->mi_set, hdrNums, nHdrNums, sizeof(*hdrNums), sorted);
return 0;
}
@ -1467,7 +1476,7 @@ int rpmdbAppendIterator(rpmdbMatchIterator mi, const int * hdrNums, int nHdrNums
if (mi->mi_set == NULL)
mi->mi_set = xcalloc(1, sizeof(*mi->mi_set));
dbiAppendSet(mi->mi_set, hdrNums, nHdrNums, sizeof(*hdrNums), 0);
(void) dbiAppendSet(mi->mi_set, hdrNums, nHdrNums, sizeof(*hdrNums), 0);
return 0;
}
@ -1622,11 +1631,11 @@ int rpmdbRemove(rpmdb rpmdb, int rid, unsigned int hdrNum)
/* Add remove transaction id to header. */
if (rid > 0) {
int_32 tid = rid;
headerAddEntry(h, RPMTAG_REMOVETID, RPM_INT32_TYPE, &tid, 1);
(void) headerAddEntry(h, RPMTAG_REMOVETID, RPM_INT32_TYPE, &tid, 1);
}
{ const char *n, *v, *r;
headerNVR(h, &n, &v, &r);
(void) headerNVR(h, &n, &v, &r);
rpmMessage(RPMMESS_DEBUG, " --- %10u %s-%s-%s\n", hdrNum, n, v, r);
}
@ -1783,7 +1792,7 @@ static INLINE int addIndexEntry(dbiIndex dbi, DBC * dbcursor,
rc = 0;
set = xcalloc(1, sizeof(*set));
}
dbiAppendSet(set, rec, 1, sizeof(*rec), 0);
(void) dbiAppendSet(set, rec, 1, sizeof(*rec), 0);
if (dbiUpdateIndex(dbi, dbcursor, keyp, keylen, set))
rc = 1;
}
@ -1813,8 +1822,8 @@ int rpmdbAdd(rpmdb rpmdb, int iid, Header h)
if (iid > 0) {
int_32 tid = iid;
headerRemoveEntry(h, RPMTAG_REMOVETID);
headerAddEntry(h, RPMTAG_INSTALLTID, RPM_INT32_TYPE, &tid, 1);
(void) headerRemoveEntry(h, RPMTAG_REMOVETID);
(void) headerAddEntry(h, RPMTAG_INSTALLTID, RPM_INT32_TYPE, &tid, 1);
}
/*
@ -1823,7 +1832,7 @@ int rpmdbAdd(rpmdb rpmdb, int iid, Header h)
* being written to the package header database.
*/
hge(h, RPMTAG_BASENAMES, &bnt, (void **) &baseNames, &count);
(void) hge(h, RPMTAG_BASENAMES, &bnt, (void **) &baseNames, &count);
if (_noDirTokens)
expandFilelist(h);
@ -1912,7 +1921,7 @@ int rpmdbAdd(rpmdb rpmdb, int iid, Header h)
if (!dbi->dbi_no_dbsync)
xx = dbiSync(dbi, 0);
{ const char *n, *v, *r;
headerNVR(h, &n, &v, &r);
(void) headerNVR(h, &n, &v, &r);
rpmMessage(RPMMESS_DEBUG, " +++ %10u %s-%s-%s\n", hdrNum, n, v, r);
}
continue;
@ -1924,11 +1933,11 @@ int rpmdbAdd(rpmdb rpmdb, int iid, Header h)
rpmcnt = count;
break;
case RPMTAG_REQUIRENAME:
hge(h, rpmtag, &rpmtype, (void **)&rpmvals, &rpmcnt);
hge(h, RPMTAG_REQUIREFLAGS, NULL, (void **)&requireFlags, NULL);
(void) hge(h, rpmtag, &rpmtype, (void **)&rpmvals, &rpmcnt);
(void) hge(h, RPMTAG_REQUIREFLAGS, NULL, (void **)&requireFlags, NULL);
break;
default:
hge(h, rpmtag, &rpmtype, (void **)&rpmvals, &rpmcnt);
(void) hge(h, rpmtag, &rpmtype, (void **)&rpmvals, &rpmcnt);
break;
}
@ -2066,7 +2075,7 @@ int rpmdbFindFpList(rpmdb rpmdb, fingerPrint * fpList, dbiIndexSet * matchList,
/* Gather all matches from the database */
for (i = 0; i < numItems; i++) {
rpmdbGrowIterator(mi, fpList[i].baseName, 0, i);
(void) rpmdbGrowIterator(mi, fpList[i].baseName, 0, i);
matchList[i] = xcalloc(1, sizeof(*(matchList[i])));
}
@ -2104,9 +2113,9 @@ int rpmdbFindFpList(rpmdb rpmdb, fingerPrint * fpList, dbiIndexSet * matchList,
num = end - start;
/* Compute fingerprints for this header's matches */
hge(h, RPMTAG_BASENAMES, &bnt, (void **) &fullBaseNames, NULL);
hge(h, RPMTAG_DIRNAMES, &dnt, (void **) &dirNames, NULL);
hge(h, RPMTAG_DIRINDEXES, NULL, (void **) &fullDirIndexes, NULL);
(void) hge(h, RPMTAG_BASENAMES, &bnt, (void **) &fullBaseNames, NULL);
(void) hge(h, RPMTAG_DIRNAMES, &dnt, (void **) &dirNames, NULL);
(void) hge(h, RPMTAG_DIRINDEXES, NULL, (void **) &fullDirIndexes, NULL);
baseNames = xcalloc(num, sizeof(*baseNames));
dirIndexes = xcalloc(num, sizeof(*dirIndexes));
@ -2122,7 +2131,7 @@ int rpmdbFindFpList(rpmdb rpmdb, fingerPrint * fpList, dbiIndexSet * matchList,
for (i = 0; i < num; i++, im++) {
if (FP_EQUAL(fps[i], fpList[im->fpNum]))
/*@-usedef@*/
dbiAppendSet(matchList[im->fpNum], im, 1, sizeof(*im), 0);
(void) dbiAppendSet(matchList[im->fpNum], im, 1, sizeof(*im), 0);
/*@=usedef@*/
}
@ -2442,7 +2451,7 @@ int rpmdbRebuild(const char * rootdir)
const char * name, * version, * release;
int skip = 0;
headerNVR(h, &name, &version, &release);
(void) headerNVR(h, &name, &version, &release);
/*@-shadow@*/
{ rpmdbMatchIterator mi;
@ -2485,14 +2494,14 @@ int rpmdbRebuild(const char * rootdir)
olddb->db_remove_env = 1;
newdb->db_remove_env = 1;
}
rpmdbClose(olddb);
rpmdbClose(newdb);
(void) rpmdbClose(olddb);
(void) rpmdbClose(newdb);
if (failed) {
rpmMessage(RPMMESS_NORMAL, _("failed to rebuild database: original database "
"remains in place\n"));
rpmdbRemoveDatabase(rootdir, newdbpath, _dbapi_rebuild);
(void) rpmdbRemoveDatabase(rootdir, newdbpath, _dbapi_rebuild);
rc = 1;
goto exit;
} else if (!nocleanup) {

View File

@ -48,32 +48,32 @@ static void printHash(const unsigned long amount, const unsigned long total)
#ifdef FANCY_HASH
if (isatty (STDOUT_FILENO)) {
int i;
for (i = 0; i < hashesPrinted; i++) putchar ('#');
for (; i < hashesTotal; i++) putchar (' ');
for (i = 0; i < hashesPrinted; i++) (void) putchar ('#');
for (; i < hashesTotal; i++) (void) putchar (' ');
printf ("(%3d%%)",
(int)(100 * (total ? (((float) amount) / total) : 1)));
for (i = 0; i < (hashesTotal + 6); i++) putchar ('\b');
for (i = 0; i < (hashesTotal + 6); i++) (void) putchar ('\b');
} else
#endif
fprintf(stdout, "#");
hashesPrinted++;
}
fflush(stdout);
(void) fflush(stdout);
hashesPrinted = hashesNeeded;
if (hashesPrinted == hashesTotal) {
#ifdef FANCY_HASH
int i;
progressCurrent++;
for (i = 1; i < hashesPrinted; i++) putchar ('#');
for (i = 1; i < hashesPrinted; i++) (void) putchar ('#');
printf (" [%3d%%]\n", (int)(100 * (progressTotal ?
(((float) progressCurrent) / progressTotal) : 1)));
#else
fprintf (stdout, "\n");
#endif
}
fflush(stdout);
(void) fflush(stdout);
}
}
@ -102,7 +102,7 @@ static void * showProgress(const void * arg, const rpmCallbackType what,
case RPMCALLBACK_INST_CLOSE_FILE:
fd = fdFree(fd, "persist (showProgress)");
if (fd) {
Fclose(fd);
(void) Fclose(fd);
fd = NULL;
}
break;
@ -120,12 +120,12 @@ static void * showProgress(const void * arg, const rpmCallbackType what,
#else
fprintf(stdout, "%-28s", s);
#endif
fflush(stdout);
(void) fflush(stdout);
} else {
s = headerSprintf(h, "%{NAME}-%{VERSION}-%{RELEASE}",
rpmTagTable, rpmHeaderFormats, NULL);
fprintf(stdout, "%s\n", s);
fflush(stdout);
(void) fflush(stdout);
}
s = _free(s);
break;
@ -138,7 +138,7 @@ static void * showProgress(const void * arg, const rpmCallbackType what,
: 100.0));
else if (flags & INSTALL_HASH)
printHash(amount, total);
fflush(stdout);
(void) fflush(stdout);
break;
case RPMCALLBACK_TRANS_START:
@ -153,7 +153,7 @@ static void * showProgress(const void * arg, const rpmCallbackType what,
fprintf(stdout, "%-28s", _("Preparing..."));
else
printf("%s\n", _("Preparing packages for installation..."));
fflush(stdout);
(void) fflush(stdout);
break;
case RPMCALLBACK_TRANS_STOP:
@ -312,13 +312,13 @@ restart:
if (fd == NULL || Ferror(fd)) {
rpmError(RPMERR_OPEN, _("open of %s failed: %s\n"), *fnp,
Fstrerror(fd));
if (fd) Fclose(fd);
if (fd) (void) Fclose(fd);
numFailed++; *fnp = NULL;
continue;
}
rpmrc = rpmReadPackageHeader(fd, &h, &isSource, NULL, NULL);
Fclose(fd);
(void) Fclose(fd);
if (rpmrc == RPMRC_FAIL || rpmrc == RPMRC_SHORTREAD) {
numFailed++; *fnp = NULL;
@ -367,7 +367,7 @@ restart:
paths = headerFreeData(paths, pft);
} else {
const char * name;
headerNVR(h, &name, NULL, NULL);
(void) headerNVR(h, &name, NULL, NULL);
rpmMessage(RPMMESS_ERROR,
_("package %s is not relocateable\n"), name);
numFailed++;
@ -383,7 +383,7 @@ restart:
Header oldH;
int count;
headerNVR(h, &name, NULL, NULL);
(void) headerNVR(h, &name, NULL, NULL);
mi = rpmdbInitIterator(db, RPMTAG_NAME, name, 0);
count = rpmdbGetIteratorCount(mi);
while ((oldH = rpmdbNextIterator(mi)) != NULL) {
@ -443,7 +443,7 @@ restart:
if (fd == NULL || Ferror(fd)) {
rpmError(RPMERR_OPEN, _("open of %s failed: %s\n"), *fnp,
Fstrerror(fd));
if (fd) Fclose(fd);
if (fd) (void) Fclose(fd);
numFailed++; *fnp = NULL;
break;
}
@ -453,7 +453,7 @@ restart:
if (rc)
rpmError(RPMERR_MANIFEST, _("%s: read manifest failed: %s\n"),
fileURL, Fstrerror(fd));
Fclose(fd);
(void) Fclose(fd);
/* If successful, restart the query loop. */
if (rc == 0) {
@ -521,7 +521,7 @@ restart:
if (fd == NULL || Ferror(fd)) {
rpmMessage(RPMMESS_ERROR, _("cannot open file %s: %s\n"),
sourceURL[i], Fstrerror(fd));
if (fd) Fclose(fd);
if (fd) (void) Fclose(fd);
continue;
}
@ -531,7 +531,7 @@ restart:
if (rpmrc != RPMRC_OK) numFailed++;
}
Fclose(fd);
(void) Fclose(fd);
}
}
@ -539,13 +539,13 @@ exit:
if (ts) rpmtransFree(ts);
for (i = 0; i < numPkgs; i++) {
if (pkgState[i] == 1)
Unlink(pkgURL[i]);
(void) Unlink(pkgURL[i]);
pkgURL[i] = _free(pkgURL[i]);
}
pkgState = _free(pkgState);
pkgURL = _free(pkgURL);
argv = _free(argv);
if (dbIsOpen) rpmdbClose(db);
if (dbIsOpen) (void) rpmdbClose(db);
return numFailed;
}
@ -628,7 +628,7 @@ int rpmErase(const char * rootdir, const char ** argv,
}
rpmtransFree(ts);
rpmdbClose(db);
(void) rpmdbClose(db);
return numFailed;
}
@ -642,7 +642,7 @@ int rpmInstallSource(const char * rootdir, const char * arg,
fd = Fopen(arg, "r.ufdio");
if (fd == NULL || Ferror(fd)) {
rpmMessage(RPMMESS_ERROR, _("cannot open %s: %s\n"), arg, Fstrerror(fd));
if (fd) Fclose(fd);
if (fd) (void) Fclose(fd);
return 1;
}
@ -663,7 +663,7 @@ int rpmInstallSource(const char * rootdir, const char * arg,
/*@=unqualifiedtrans@*/
}
Fclose(fd);
(void) Fclose(fd);
return rc;
}

View File

@ -612,7 +612,7 @@ static int doReadRC( /*@killref@*/ FD_t fd, const char * urlfn)
{ off_t size = fdSize(fd);
size_t nb = (size >= 0 ? size : (8*BUFSIZ - 2));
if (nb == 0) {
Fclose(fd);
(void) Fclose(fd);
return 0;
}
next = alloca(nb + 2);
@ -624,7 +624,7 @@ static int doReadRC( /*@killref@*/ FD_t fd, const char * urlfn)
rc = 1;
} else
rc = 0;
Fclose(fd);
(void) Fclose(fd);
if (rc) return rc;
next[nb] = '\n';
next[nb + 1] = '\0';
@ -962,7 +962,7 @@ static void defaultMachine(/*@out@*/ const char ** arch, /*@out@*/ const char **
const struct canonEntry * canon;
if (!gotDefaults) {
uname(&un);
(void) uname(&un);
#if !defined(__linux__)
#ifdef SNI
@ -1017,7 +1017,7 @@ static void defaultMachine(/*@out@*/ const char ** arch, /*@out@*/ const char **
if (!Ferror(fd)) {
chptr = xcalloc(1, 256);
{ int irelid = Fread(chptr, sizeof(*chptr), 256, fd);
Fclose(fd);
(void) Fclose(fd);
/* example: "112393 RELEASE 020200 Version 01 OS" */
if (irelid > 0) {
if ((prelid = strstr(chptr, "RELEASE "))){

View File

@ -162,7 +162,7 @@ rpmRC rpmReadSignature(FD_t fd, Header * headerp, sigType sig_type)
if (timedRead(fd, buf, 256) != 256)
break;
h = headerNew();
headerAddEntry(h, RPMSIGTAG_PGP, RPM_BIN_TYPE, buf, 152);
(void) headerAddEntry(h, RPMSIGTAG_PGP, RPM_BIN_TYPE, buf, 152);
rc = RPMRC_OK;
break;
case RPMSIGTYPE_MD5:
@ -248,7 +248,7 @@ static int makePGPSignature(const char * file, /*@out@*/ void ** sig,
(void) stpcpy( stpcpy(sigfile, file), ".sig");
inpipe[0] = inpipe[1] = 0;
pipe(inpipe);
(void) pipe(inpipe);
if (!(pid = fork())) {
const char *pgp_path = rpmExpand("%{_pgp_path}", NULL);
@ -256,24 +256,24 @@ static int makePGPSignature(const char * file, /*@out@*/ void ** sig,
const char *path;
pgpVersion pgpVer;
close(STDIN_FILENO);
dup2(inpipe[0], 3);
close(inpipe[1]);
(void) close(STDIN_FILENO);
(void) dup2(inpipe[0], 3);
(void) close(inpipe[1]);
dosetenv("PGPPASSFD", "3", 1);
(void) dosetenv("PGPPASSFD", "3", 1);
if (pgp_path && *pgp_path != '%')
dosetenv("PGPPATH", pgp_path, 1);
(void) dosetenv("PGPPATH", pgp_path, 1);
/* dosetenv("PGPPASS", passPhrase, 1); */
if ((path = rpmDetectPGPVersion(&pgpVer)) != NULL) {
switch(pgpVer) {
case PGP_2:
execlp(path, "pgp", "+batchmode=on", "+verbose=0", "+armor=off",
(void) execlp(path, "pgp", "+batchmode=on", "+verbose=0", "+armor=off",
name, "-sb", file, sigfile, NULL);
break;
case PGP_5:
execlp(path,"pgps", "+batchmode=on", "+verbose=0", "+armor=off",
(void) execlp(path,"pgps", "+batchmode=on", "+verbose=0", "+armor=off",
name, "-b", file, "-o", sigfile, NULL);
break;
case PGP_UNKNOWN:
@ -285,10 +285,10 @@ static int makePGPSignature(const char * file, /*@out@*/ void ** sig,
_exit(RPMERR_EXEC);
}
close(inpipe[0]);
(void)write(inpipe[1], passPhrase, strlen(passPhrase));
(void)write(inpipe[1], "\n", 1);
close(inpipe[1]);
(void) close(inpipe[0]);
(void) write(inpipe[1], passPhrase, strlen(passPhrase));
(void) write(inpipe[1], "\n", 1);
(void) close(inpipe[1]);
(void)waitpid(pid, &status, 0);
if (!WIFEXITED(status) || WEXITSTATUS(status)) {
@ -298,7 +298,7 @@ static int makePGPSignature(const char * file, /*@out@*/ void ** sig,
if (stat(sigfile, &st)) {
/* PGP failed to write signature */
unlink(sigfile); /* Just in case */
(void) unlink(sigfile); /* Just in case */
rpmError(RPMERR_SIGGEN, _("pgp failed to write signature\n"));
return 1;
}
@ -311,10 +311,10 @@ static int makePGPSignature(const char * file, /*@out@*/ void ** sig,
int rc;
fd = Fopen(sigfile, "r.fdio");
rc = timedRead(fd, *sig, *size);
unlink(sigfile);
Fclose(fd);
(void) unlink(sigfile);
(void) Fclose(fd);
if (rc != *size) {
free(*sig);
*sig = _free(*sig);
rpmError(RPMERR_SIGGEN, _("unable to read the signature\n"));
return 1;
}
@ -342,19 +342,19 @@ static int makeGPGSignature(const char * file, /*@out@*/ void ** sig,
(void) stpcpy( stpcpy(sigfile, file), ".sig");
inpipe[0] = inpipe[1] = 0;
pipe(inpipe);
(void) pipe(inpipe);
if (!(pid = fork())) {
const char *gpg_path = rpmExpand("%{_gpg_path}", NULL);
const char *name = rpmExpand("%{_gpg_name}", NULL);
close(STDIN_FILENO);
dup2(inpipe[0], 3);
close(inpipe[1]);
(void) close(STDIN_FILENO);
(void) dup2(inpipe[0], 3);
(void) close(inpipe[1]);
if (gpg_path && *gpg_path != '%')
dosetenv("GNUPGHOME", gpg_path, 1);
execlp("gpg", "gpg",
(void) dosetenv("GNUPGHOME", gpg_path, 1);
(void) execlp("gpg", "gpg",
"--batch", "--no-verbose", "--no-armor", "--passphrase-fd", "3",
"-u", name, "-sbo", sigfile, file,
NULL);
@ -363,9 +363,9 @@ static int makeGPGSignature(const char * file, /*@out@*/ void ** sig,
}
fpipe = fdopen(inpipe[1], "w");
close(inpipe[0]);
(void) close(inpipe[0]);
fprintf(fpipe, "%s\n", passPhrase);
fclose(fpipe);
(void) fclose(fpipe);
(void)waitpid(pid, &status, 0);
if (!WIFEXITED(status) || WEXITSTATUS(status)) {
@ -375,7 +375,7 @@ static int makeGPGSignature(const char * file, /*@out@*/ void ** sig,
if (stat(sigfile, &st)) {
/* GPG failed to write signature */
unlink(sigfile); /* Just in case */
(void) unlink(sigfile); /* Just in case */
rpmError(RPMERR_SIGGEN, _("gpg failed to write signature\n"));
return 1;
}
@ -388,10 +388,10 @@ static int makeGPGSignature(const char * file, /*@out@*/ void ** sig,
int rc;
fd = Fopen(sigfile, "r.fdio");
rc = timedRead(fd, *sig, *size);
unlink(sigfile);
Fclose(fd);
(void) unlink(sigfile);
(void) Fclose(fd);
if (rc != *size) {
free(*sig);
*sig = _free(*sig);
rpmError(RPMERR_SIGGEN, _("unable to read the signature\n"));
return 1;
}
@ -413,28 +413,28 @@ int rpmAddSignature(Header header, const char * file, int_32 sigTag,
switch (sigTag) {
case RPMSIGTAG_SIZE:
stat(file, &st);
(void) stat(file, &st);
size = st.st_size;
ret = 0;
headerAddEntry(header, RPMSIGTAG_SIZE, RPM_INT32_TYPE, &size, 1);
(void) headerAddEntry(header, RPMSIGTAG_SIZE, RPM_INT32_TYPE, &size, 1);
break;
case RPMSIGTAG_MD5:
ret = mdbinfile(file, buf);
if (ret == 0)
headerAddEntry(header, sigTag, RPM_BIN_TYPE, buf, 16);
(void) headerAddEntry(header, sigTag, RPM_BIN_TYPE, buf, 16);
break;
case RPMSIGTAG_PGP5: /* XXX legacy */
case RPMSIGTAG_PGP:
rpmMessage(RPMMESS_VERBOSE, _("Generating signature using PGP.\n"));
ret = makePGPSignature(file, &sig, &size, passPhrase);
if (ret == 0)
headerAddEntry(header, sigTag, RPM_BIN_TYPE, sig, size);
(void) headerAddEntry(header, sigTag, RPM_BIN_TYPE, sig, size);
break;
case RPMSIGTAG_GPG:
rpmMessage(RPMMESS_VERBOSE, _("Generating signature using GPG.\n"));
ret = makeGPGSignature(file, &sig, &size, passPhrase);
if (ret == 0)
headerAddEntry(header, sigTag, RPM_BIN_TYPE, sig, size);
(void) headerAddEntry(header, sigTag, RPM_BIN_TYPE, sig, size);
break;
}
@ -446,7 +446,7 @@ verifySizeSignature(const char * datafile, int_32 size, char * result)
{
struct stat st;
stat(datafile, &st);
(void) stat(datafile, &st);
if (size != st.st_size) {
sprintf(result, "Header+Archive size mismatch.\n"
"Expected %d, saw %d.\n",
@ -466,7 +466,7 @@ verifyMD5Signature(const char * datafile, const byte * sig,
{
byte md5sum[16];
fn(datafile, md5sum);
(void) fn(datafile, md5sum);
if (memcmp(md5sum, sig, 16)) {
sprintf(result, "MD5 sum mismatch\n"
"Expected: %02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x"
@ -529,21 +529,21 @@ verifyPGPSignature(const char * datafile, const void * sig, int count,
}
sfd = Fopen(sigfile, "w.fdio");
(void)Fwrite(sig, sizeof(char), count, sfd);
Fclose(sfd);
(void) Fclose(sfd);
/* Now run PGP */
outpipe[0] = outpipe[1] = 0;
pipe(outpipe);
(void) pipe(outpipe);
if (!(pid = fork())) {
const char *pgp_path = rpmExpand("%{_pgp_path}", NULL);
close(outpipe[0]);
close(STDOUT_FILENO); /* XXX unnecessary */
dup2(outpipe[1], STDOUT_FILENO);
(void) close(outpipe[0]);
(void) close(STDOUT_FILENO); /* XXX unnecessary */
(void) dup2(outpipe[1], STDOUT_FILENO);
if (pgp_path && *pgp_path != '%')
dosetenv("PGPPATH", pgp_path, 1);
(void) dosetenv("PGPPATH", pgp_path, 1);
switch (pgpVer) {
case PGP_5:
@ -551,19 +551,19 @@ verifyPGPSignature(const char * datafile, const void * sig, int count,
/* another message") is _always_ written to stderr; we */
/* want to catch that output, so dup stdout to stderr: */
{ int save_stderr = dup(2);
dup2(1, 2);
execlp(path, "pgpv", "+batchmode=on", "+verbose=0",
(void) dup2(1, 2);
(void) execlp(path, "pgpv", "+batchmode=on", "+verbose=0",
/* Write "Good signature..." to stdout: */
"+OutputInformationFD=1",
/* Write "WARNING: ... is not trusted to... to stdout: */
"+OutputWarningFD=1",
sigfile, "-o", datafile, NULL);
/* Restore stderr so we can print the error message below. */
dup2(save_stderr, 2);
close(save_stderr);
(void) dup2(save_stderr, 2);
(void) close(save_stderr);
} break;
case PGP_2:
execlp(path, "pgp", "+batchmode=on", "+verbose=0",
(void) execlp(path, "pgp", "+batchmode=on", "+verbose=0",
sigfile, datafile, NULL);
break;
case PGP_UNKNOWN:
@ -576,7 +576,7 @@ verifyPGPSignature(const char * datafile, const void * sig, int count,
_exit(RPMERR_EXEC);
}
close(outpipe[1]);
(void) close(outpipe[1]);
file = fdopen(outpipe[0], "r");
result[0] = '\0';
while (fgets(buf, 1024, file)) {
@ -595,10 +595,10 @@ verifyPGPSignature(const char * datafile, const void * sig, int count,
else if (!strncmp("Good signature", buf, 14))
res = RPMSIG_OK;
}
fclose(file);
(void) fclose(file);
(void)waitpid(pid, &status, 0);
unlink(sigfile);
(void) waitpid(pid, &status, 0);
(void) unlink(sigfile);
if (!res && (!WIFEXITED(status) || WEXITSTATUS(status))) {
res = RPMSIG_BAD;
}
@ -623,24 +623,24 @@ verifyGPGSignature(const char * datafile, const void * sig, int count,
tmppath = _free(tmppath);
}
sfd = Fopen(sigfile, "w.fdio");
(void)Fwrite(sig, sizeof(char), count, sfd);
Fclose(sfd);
(void) Fwrite(sig, sizeof(char), count, sfd);
(void) Fclose(sfd);
/* Now run GPG */
outpipe[0] = outpipe[1] = 0;
pipe(outpipe);
(void) pipe(outpipe);
if (!(pid = fork())) {
const char *gpg_path = rpmExpand("%{_gpg_path}", NULL);
close(outpipe[0]);
(void) close(outpipe[0]);
/* gpg version 0.9 sends its output to stderr. */
dup2(outpipe[1], STDERR_FILENO);
(void) dup2(outpipe[1], STDERR_FILENO);
if (gpg_path && *gpg_path != '%')
dosetenv("GNUPGHOME", gpg_path, 1);
(void) dosetenv("GNUPGHOME", gpg_path, 1);
execlp("gpg", "gpg",
(void) execlp("gpg", "gpg",
"--batch", "--no-verbose",
"--verify", sigfile, datafile,
NULL);
@ -649,7 +649,7 @@ verifyGPGSignature(const char * datafile, const void * sig, int count,
_exit(RPMERR_EXEC);
}
close(outpipe[1]);
(void) close(outpipe[1]);
file = fdopen(outpipe[0], "r");
result[0] = '\0';
while (fgets(buf, 1024, file)) {
@ -658,10 +658,10 @@ verifyGPGSignature(const char * datafile, const void * sig, int count,
res = RPMSIG_NOKEY;
}
}
fclose(file);
(void) fclose(file);
(void)waitpid(pid, &status, 0);
unlink(sigfile);
(void) waitpid(pid, &status, 0);
(void) unlink(sigfile);
if (!res && (!WIFEXITED(status) || WEXITSTATUS(status))) {
res = RPMSIG_BAD;
}
@ -676,31 +676,31 @@ static int checkPassPhrase(const char * passPhrase, const int sigTag)
int fd;
passPhrasePipe[0] = passPhrasePipe[1] = 0;
pipe(passPhrasePipe);
(void) pipe(passPhrasePipe);
if (!(pid = fork())) {
close(STDIN_FILENO);
close(STDOUT_FILENO);
close(passPhrasePipe[1]);
(void) close(STDIN_FILENO);
(void) close(STDOUT_FILENO);
(void) close(passPhrasePipe[1]);
if (! rpmIsVerbose()) {
close(STDERR_FILENO);
(void) close(STDERR_FILENO);
}
if ((fd = open("/dev/null", O_RDONLY)) != STDIN_FILENO) {
dup2(fd, STDIN_FILENO);
close(fd);
(void) dup2(fd, STDIN_FILENO);
(void) close(fd);
}
if ((fd = open("/dev/null", O_WRONLY)) != STDOUT_FILENO) {
dup2(fd, STDOUT_FILENO);
close(fd);
(void) dup2(fd, STDOUT_FILENO);
(void) close(fd);
}
dup2(passPhrasePipe[0], 3);
(void) dup2(passPhrasePipe[0], 3);
switch (sigTag) {
case RPMSIGTAG_GPG:
{ const char *gpg_path = rpmExpand("%{_gpg_path}", NULL);
const char *name = rpmExpand("%{_gpg_name}", NULL);
if (gpg_path && *gpg_path != '%')
dosetenv("GNUPGHOME", gpg_path, 1);
execlp("gpg", "gpg",
(void) dosetenv("GNUPGHOME", gpg_path, 1);
(void) execlp("gpg", "gpg",
"--batch", "--no-verbose", "--passphrase-fd", "3",
"-u", name, "-so", "-",
NULL);
@ -714,18 +714,18 @@ static int checkPassPhrase(const char * passPhrase, const int sigTag)
const char *path;
pgpVersion pgpVer;
dosetenv("PGPPASSFD", "3", 1);
(void) dosetenv("PGPPASSFD", "3", 1);
if (pgp_path && *pgp_path != '%')
dosetenv("PGPPATH", pgp_path, 1);
(void) dosetenv("PGPPATH", pgp_path, 1);
if ((path = rpmDetectPGPVersion(&pgpVer)) != NULL) {
switch(pgpVer) {
case PGP_2:
execlp(path, "pgp", "+batchmode=on", "+verbose=0",
(void) execlp(path, "pgp", "+batchmode=on", "+verbose=0",
name, "-sf", NULL);
break;
case PGP_5: /* XXX legacy */
execlp(path,"pgps", "+batchmode=on", "+verbose=0",
(void) execlp(path,"pgps", "+batchmode=on", "+verbose=0",
name, "-f", NULL);
break;
case PGP_UNKNOWN:
@ -743,10 +743,10 @@ static int checkPassPhrase(const char * passPhrase, const int sigTag)
}
}
close(passPhrasePipe[0]);
(void)write(passPhrasePipe[1], passPhrase, strlen(passPhrase));
(void)write(passPhrasePipe[1], "\n", 1);
close(passPhrasePipe[1]);
(void) close(passPhrasePipe[0]);
(void) write(passPhrasePipe[1], passPhrase, strlen(passPhrase));
(void) write(passPhrasePipe[1], "\n", 1);
(void) close(passPhrasePipe[1]);
(void)waitpid(pid, &status, 0);
if (!WIFEXITED(status) || WEXITSTATUS(status)) {

View File

@ -168,7 +168,7 @@ static void psAppend(rpmProblemSet probs, rpmProblemType type,
if (altH) {
const char * n, * v, * r;
headerNVR(altH, &n, &v, &r);
(void) headerNVR(altH, &n, &v, &r);
p->altNEVR =
t = xmalloc(strlen(n) + strlen(v) + strlen(r) + sizeof("--"));
t = stpcpy(t, n);
@ -186,7 +186,7 @@ static int archOkay(Header h)
int type, count;
/* make sure we're trying to install this on the proper architecture */
headerGetEntry(h, RPMTAG_ARCH, &type, (void **) &pkgArch, &count);
(void) headerGetEntry(h, RPMTAG_ARCH, &type, (void **) &pkgArch, &count);
#ifndef DYING
if (type == RPM_INT8_TYPE) {
int_8 * pkgArchNum;
@ -216,7 +216,7 @@ static int osOkay(Header h)
int type, count;
/* make sure we're trying to install this on the proper os */
headerGetEntry(h, RPMTAG_OS, &type, (void **) &pkgOs, &count);
(void) headerGetEntry(h, RPMTAG_OS, &type, (void **) &pkgOs, &count);
#ifndef DYING
if (type == RPM_INT8_TYPE) {
/* v1 packages and v2 packages both used improper OS numbers, so just
@ -338,7 +338,7 @@ static Header relocateFileList(const rpmTransactionSet ts, TFI_t fi,
if (numRelocations == 0) {
if (numValid) {
if (!headerIsEntry(origH, RPMTAG_INSTPREFIXES))
headerAddEntry(origH, RPMTAG_INSTPREFIXES,
(void) headerAddEntry(origH, RPMTAG_INSTPREFIXES,
validType, validRelocations, numValid);
validRelocations = hfd(validRelocations, validType);
}
@ -447,18 +447,18 @@ static Header relocateFileList(const rpmTransactionSet ts, TFI_t fi,
}
if (numActual)
headerAddEntry(h, RPMTAG_INSTPREFIXES, RPM_STRING_ARRAY_TYPE,
(void) headerAddEntry(h, RPMTAG_INSTPREFIXES, RPM_STRING_ARRAY_TYPE,
(void **) actualRelocations, numActual);
actualRelocations = _free(actualRelocations);
validRelocations = hfd(validRelocations, validType);
}
hge(h, RPMTAG_BASENAMES, NULL, (void **) &baseNames, &fileCount);
hge(h, RPMTAG_DIRINDEXES, NULL, (void **) &dirIndexes, NULL);
hge(h, RPMTAG_DIRNAMES, NULL, (void **) &dirNames, &dirCount);
hge(h, RPMTAG_FILEFLAGS, NULL, (void **) &fFlags, NULL);
hge(h, RPMTAG_FILEMODES, NULL, (void **) &fModes, NULL);
(void) hge(h, RPMTAG_BASENAMES, NULL, (void **) &baseNames, &fileCount);
(void) hge(h, RPMTAG_DIRINDEXES, NULL, (void **) &dirIndexes, NULL);
(void) hge(h, RPMTAG_DIRNAMES, NULL, (void **) &dirNames, &dirCount);
(void) hge(h, RPMTAG_FILEFLAGS, NULL, (void **) &fFlags, NULL);
(void) hge(h, RPMTAG_FILEMODES, NULL, (void **) &fModes, NULL);
skipDirList = alloca(dirCount * sizeof(*skipDirList));
memset(skipDirList, 0, dirCount * sizeof(*skipDirList));
@ -647,33 +647,33 @@ static Header relocateFileList(const rpmTransactionSet ts, TFI_t fi,
int t;
p = NULL;
hge(h, RPMTAG_BASENAMES, &t, &p, &c);
headerAddEntry(h, RPMTAG_ORIGBASENAMES, t, p, c);
(void) hge(h, RPMTAG_BASENAMES, &t, &p, &c);
(void) headerAddEntry(h, RPMTAG_ORIGBASENAMES, t, p, c);
p = hfd(p, t);
p = NULL;
hge(h, RPMTAG_DIRNAMES, &t, &p, &c);
headerAddEntry(h, RPMTAG_ORIGDIRNAMES, t, p, c);
(void) hge(h, RPMTAG_DIRNAMES, &t, &p, &c);
(void) headerAddEntry(h, RPMTAG_ORIGDIRNAMES, t, p, c);
p = hfd(p, t);
p = NULL;
hge(h, RPMTAG_DIRINDEXES, &t, &p, &c);
headerAddEntry(h, RPMTAG_ORIGDIRINDEXES, t, p, c);
(void) hge(h, RPMTAG_DIRINDEXES, &t, &p, &c);
(void) headerAddEntry(h, RPMTAG_ORIGDIRINDEXES, t, p, c);
p = hfd(p, t);
headerModifyEntry(h, RPMTAG_BASENAMES, RPM_STRING_ARRAY_TYPE,
(void) headerModifyEntry(h, RPMTAG_BASENAMES, RPM_STRING_ARRAY_TYPE,
baseNames, fileCount);
fi->bnl = hfd(fi->bnl, RPM_STRING_ARRAY_TYPE);
hge(h, RPMTAG_BASENAMES, NULL, (void **) &fi->bnl, &fi->fc);
(void) hge(h, RPMTAG_BASENAMES, NULL, (void **) &fi->bnl, &fi->fc);
headerModifyEntry(h, RPMTAG_DIRNAMES, RPM_STRING_ARRAY_TYPE,
(void) headerModifyEntry(h, RPMTAG_DIRNAMES, RPM_STRING_ARRAY_TYPE,
dirNames, dirCount);
fi->dnl = hfd(fi->dnl, RPM_STRING_ARRAY_TYPE);
hge(h, RPMTAG_DIRNAMES, NULL, (void **) &fi->dnl, &fi->dc);
(void) hge(h, RPMTAG_DIRNAMES, NULL, (void **) &fi->dnl, &fi->dc);
headerModifyEntry(h, RPMTAG_DIRINDEXES, RPM_INT32_TYPE,
(void) headerModifyEntry(h, RPMTAG_DIRINDEXES, RPM_INT32_TYPE,
dirIndexes, fileCount);
hge(h, RPMTAG_DIRINDEXES, NULL, (void **) &fi->dil, NULL);
(void) hge(h, RPMTAG_DIRINDEXES, NULL, (void **) &fi->dil, NULL);
}
baseNames = hfd(baseNames, RPM_STRING_ARRAY_TYPE);
@ -879,12 +879,12 @@ static int handleInstInstalledFiles(TFI_t fi, rpmdb db,
return 1;
}
hge(h, RPMTAG_FILEMD5S, &omtype, (void **) &otherMd5s, NULL);
hge(h, RPMTAG_FILELINKTOS, &oltype, (void **) &otherLinks, NULL);
hge(h, RPMTAG_FILESTATES, NULL, (void **) &otherStates, NULL);
hge(h, RPMTAG_FILEMODES, NULL, (void **) &otherModes, NULL);
hge(h, RPMTAG_FILEFLAGS, NULL, (void **) &otherFlags, NULL);
hge(h, RPMTAG_FILESIZES, NULL, (void **) &otherSizes, NULL);
(void) hge(h, RPMTAG_FILEMD5S, &omtype, (void **) &otherMd5s, NULL);
(void) hge(h, RPMTAG_FILELINKTOS, &oltype, (void **) &otherLinks, NULL);
(void) hge(h, RPMTAG_FILESTATES, NULL, (void **) &otherStates, NULL);
(void) hge(h, RPMTAG_FILEMODES, NULL, (void **) &otherModes, NULL);
(void) hge(h, RPMTAG_FILEFLAGS, NULL, (void **) &otherFlags, NULL);
(void) hge(h, RPMTAG_FILESIZES, NULL, (void **) &otherSizes, NULL);
fi->replaced = xmalloc(sharedCount * sizeof(*fi->replaced));
@ -964,7 +964,7 @@ static int handleRmvdInstalledFiles(TFI_t fi, rpmdb db,
return 1;
}
hge(h, RPMTAG_FILESTATES, NULL, (void **) &otherStates, NULL);
(void) hge(h, RPMTAG_FILESTATES, NULL, (void **) &otherStates, NULL);
for (i = 0; i < sharedCount; i++, shared++) {
int otherFileNum, fileNum;
@ -1023,7 +1023,7 @@ static void handleOverlappedFiles(TFI_t fi, hashTable ht,
* will be installed and removed so the records for an overlapped
* files will be sorted in exactly the same order.
*/
htGetEntry(ht, &fi->fps[i], (const void ***) &recs, &numRecs, NULL);
(void) htGetEntry(ht, &fi->fps[i], (const void ***) &recs, &numRecs, NULL);
/*
* If this package is being added, look only at other packages
@ -1540,7 +1540,7 @@ int rpmRunTransactions( rpmTransactionSet ts,
ts->di[i].iavail = !(sfb.f_ffree == 0 && sfb.f_files == 0)
? sfb.f_ffree : -1;
stat(ts->filesystems[i], &sb);
(void) stat(ts->filesystems[i], &sb);
ts->di[i].dev = sb.st_dev;
}
}
@ -1574,7 +1574,7 @@ int rpmRunTransactions( rpmTransactionSet ts,
Header oldH;
mi = rpmdbInitIterator(ts->rpmdb, RPMTAG_NAME, alp->name, 0);
while ((oldH = rpmdbNextIterator(mi)) != NULL)
ensureOlder(alp, oldH, ts->probs);
(void) ensureOlder(alp, oldH, ts->probs);
mi = rpmdbFreeIterator(mi);
}
@ -1604,7 +1604,7 @@ int rpmRunTransactions( rpmTransactionSet ts,
int fileCount;
mi = rpmdbInitIterator(ts->rpmdb, RPMDBI_PACKAGES, NULL, 0);
rpmdbAppendIterator(mi, ts->removedPackages, ts->numRemovedPackages);
(void) rpmdbAppendIterator(mi, ts->removedPackages, ts->numRemovedPackages);
while ((h = rpmdbNextIterator(mi)) != NULL) {
if (headerGetEntry(h, RPMTAG_BASENAMES, NULL, NULL, &fileCount))
totalFileCount += fileCount;
@ -1675,10 +1675,10 @@ int rpmRunTransactions( rpmTransactionSet ts,
tsi = tsFreeIterator(tsi);
/* Open all database indices before installing. */
rpmdbOpenAll(ts->rpmdb);
(void) rpmdbOpenAll(ts->rpmdb);
if (!ts->chrootDone) {
chdir("/");
(void) chdir("/");
/*@-unrecog@*/ chroot(ts->rootDir); /*@=unrecog@*/
ts->chrootDone = 1;
}
@ -1791,13 +1791,13 @@ int rpmRunTransactions( rpmTransactionSet ts,
/* Determine the fate of each file. */
switch (fi->type) {
case TR_ADDED:
handleInstInstalledFiles(fi, ts->rpmdb, shared, nexti - i,
(void) handleInstInstalledFiles(fi, ts->rpmdb, shared, nexti - i,
!(beingRemoved || (ts->ignoreSet & RPMPROB_FILTER_REPLACEOLDFILES)),
ts->probs, ts->transFlags);
break;
case TR_REMOVED:
if (!beingRemoved)
handleRmvdInstalledFiles(fi, ts->rpmdb, shared, nexti - i);
(void) handleRmvdInstalledFiles(fi, ts->rpmdb, shared, nexti - i);
break;
}
}
@ -1842,7 +1842,7 @@ int rpmRunTransactions( rpmTransactionSet ts,
if (ts->chrootDone) {
/*@-unrecog@*/ chroot("."); /*@-unrecog@*/
ts->chrootDone = 0;
chdir(ts->currDir);
(void) chdir(ts->currDir);
}
NOTIFY(ts, (NULL, RPMCALLBACK_TRANS_STOP, 6, ts->flEntries,
@ -1953,7 +1953,7 @@ assert(alp == fi->ap);
if (alp->multiLib)
ts->transFlags |= RPMTRANS_FLAG_MULTILIB;
if (fi->ap == NULL) fi->ap = alp; /* XXX WTFO? */
assert(alp == fi->ap);
if (psmStage(psm, PSM_PKGINSTALL)) {
ourrc++;
lastFailed = i;

View File

@ -75,37 +75,31 @@ struct poptOption rpmVerifyPoptTable[] = {
int rpmVerifyFile(const char * prefix, Header h, int filenum,
int * result, int omitMask)
{
char ** baseNames, ** md5List, ** linktoList, ** dirNames;
HGE_t hge = (HGE_t)headerGetEntryMinMemory;
HFD_t hfd = headerFreeData;
int_32 * verifyFlags;
rpmVerifyAttrs flags;
int_32 * sizeList, * mtimeList, * dirIndexes;
unsigned short * modeList, * rdevList;
char * fileStatesList;
unsigned short * modeList;
const char * fileStatesList;
char * filespec;
char * name;
gid_t gid;
int type, count, rc;
int count;
int rc;
struct stat sb;
unsigned char md5sum[40];
int_32 * uidList, * gidList;
char linkto[1024];
int size;
char ** unameList, ** gnameList;
int_32 useBrokenMd5;
if (IS_BIG_ENDIAN()) { /* XXX was ifdef WORDS_BIGENDIAN */
int_32 * brokenPtr;
if (!headerGetEntry(h, RPMTAG_BROKENMD5, NULL, (void **) &brokenPtr, NULL)) {
char * rpmVersion;
if (!hge(h, RPMTAG_BROKENMD5, NULL, (void **) &brokenPtr, NULL)) {
const char * rpmVersion;
if (headerGetEntry(h, RPMTAG_RPMVERSION, NULL, (void **) &rpmVersion,
NULL)) {
if (hge(h, RPMTAG_RPMVERSION, NULL, (void **) &rpmVersion, NULL)) {
useBrokenMd5 = ((rpmvercmp(rpmVersion, "2.3.3") >= 0) &&
(rpmvercmp(rpmVersion, "2.3.8") <= 0));
} else {
useBrokenMd5 = 1;
}
headerAddEntry(h, RPMTAG_BROKENMD5, RPM_INT32_TYPE, &useBrokenMd5, 1);
(void) headerAddEntry(h, RPMTAG_BROKENMD5, RPM_INT32_TYPE,
&useBrokenMd5, 1);
} else {
useBrokenMd5 = *brokenPtr;
}
@ -113,33 +107,38 @@ int rpmVerifyFile(const char * prefix, Header h, int filenum,
useBrokenMd5 = 0;
}
headerGetEntry(h, RPMTAG_FILEMODES, &type, (void **) &modeList, &count);
(void) hge(h, RPMTAG_FILEMODES, NULL, (void **) &modeList, &count);
if (headerGetEntry(h, RPMTAG_FILEVERIFYFLAGS, &type, (void **) &verifyFlags,
&count)) {
if (hge(h, RPMTAG_FILEVERIFYFLAGS, NULL, (void **) &verifyFlags, NULL)) {
flags = verifyFlags[filenum];
} else {
flags = RPMVERIFY_ALL;
}
headerGetEntry(h, RPMTAG_BASENAMES, &type, (void **) &baseNames,
&count);
headerGetEntry(h, RPMTAG_DIRINDEXES, &type, (void **) &dirIndexes,
NULL);
headerGetEntry(h, RPMTAG_DIRNAMES, &type, (void **) &dirNames, NULL);
{
const char ** baseNames;
const char ** dirNames;
int_32 * dirIndexes;
int bnt, dnt;
filespec = alloca(strlen(dirNames[dirIndexes[filenum]]) +
(void) hge(h, RPMTAG_BASENAMES, &bnt, (void **) &baseNames, NULL);
(void) hge(h, RPMTAG_DIRINDEXES, NULL, (void **) &dirIndexes, NULL);
(void) hge(h, RPMTAG_DIRNAMES, &dnt, (void **) &dirNames, NULL);
filespec = alloca(strlen(dirNames[dirIndexes[filenum]]) +
strlen(baseNames[filenum]) + strlen(prefix) + 5);
sprintf(filespec, "%s/%s%s", prefix, dirNames[dirIndexes[filenum]],
sprintf(filespec, "%s/%s%s", prefix, dirNames[dirIndexes[filenum]],
baseNames[filenum]);
free(baseNames);
free(dirNames);
baseNames = hfd(baseNames, bnt);
dirNames = hfd(dirNames, dnt);
}
*result = 0;
/* Check to see if the file was installed - if not pretend all is OK */
if (headerGetEntry(h, RPMTAG_FILESTATES, &type,
(void **) &fileStatesList, &count) && fileStatesList) {
if (hge(h, RPMTAG_FILESTATES, NULL, (void **) &fileStatesList, NULL) &&
fileStatesList != NULL)
{
if (fileStatesList[filenum] == RPMFILE_STATE_NOTINSTALLED)
return 0;
}
@ -175,7 +174,11 @@ int rpmVerifyFile(const char * prefix, Header h, int filenum,
flags &= ~(omitMask | RPMVERIFY_LSTATFAIL|RPMVERIFY_READFAIL|RPMVERIFY_READLINKFAIL);
if (flags & RPMVERIFY_MD5) {
headerGetEntry(h, RPMTAG_FILEMD5S, &type, (void **) &md5List, &count);
unsigned char md5sum[40];
const char ** md5List;
int mdt;
(void) hge(h, RPMTAG_FILEMD5S, &mdt, (void **) &md5List, NULL);
if (useBrokenMd5) {
rc = mdfileBroken(filespec, md5sum);
} else {
@ -186,10 +189,16 @@ int rpmVerifyFile(const char * prefix, Header h, int filenum,
*result |= (RPMVERIFY_READFAIL|RPMVERIFY_MD5);
else if (strcmp(md5sum, md5List[filenum]))
*result |= RPMVERIFY_MD5;
free(md5List);
md5List = hfd(md5List, mdt);
}
if (flags & RPMVERIFY_LINKTO) {
headerGetEntry(h, RPMTAG_FILELINKTOS, &type, (void **) &linktoList, &count);
char linkto[1024];
int size;
const char ** linktoList;
int ltt;
(void) hge(h, RPMTAG_FILELINKTOS, &ltt, (void **) &linktoList, NULL);
size = readlink(filespec, linkto, sizeof(linkto)-1);
if (size == -1)
*result |= (RPMVERIFY_READLINKFAIL|RPMVERIFY_LINKTO);
@ -198,11 +207,13 @@ int rpmVerifyFile(const char * prefix, Header h, int filenum,
if (strcmp(linkto, linktoList[filenum]))
*result |= RPMVERIFY_LINKTO;
}
free(linktoList);
linktoList = hfd(linktoList, ltt);
}
if (flags & RPMVERIFY_FILESIZE) {
headerGetEntry(h, RPMTAG_FILESIZES, &type, (void **) &sizeList, &count);
int_32 * sizeList;
(void) hge(h, RPMTAG_FILESIZES, NULL, (void **) &sizeList, NULL);
if (sizeList[filenum] != sb.st_size)
*result |= RPMVERIFY_FILESIZE;
}
@ -221,28 +232,33 @@ int rpmVerifyFile(const char * prefix, Header h, int filenum,
S_ISBLK(modeList[filenum]) != S_ISBLK(sb.st_mode)) {
*result |= RPMVERIFY_RDEV;
} else if (S_ISDEV(modeList[filenum]) && S_ISDEV(sb.st_mode)) {
headerGetEntry(h, RPMTAG_FILERDEVS, NULL, (void **) &rdevList,
NULL);
unsigned short * rdevList;
(void) hge(h, RPMTAG_FILERDEVS, NULL, (void **) &rdevList, NULL);
if (rdevList[filenum] != sb.st_rdev)
*result |= RPMVERIFY_RDEV;
}
}
if (flags & RPMVERIFY_MTIME) {
headerGetEntry(h, RPMTAG_FILEMTIMES, NULL, (void **) &mtimeList, NULL);
int_32 * mtimeList;
(void) hge(h, RPMTAG_FILEMTIMES, NULL, (void **) &mtimeList, NULL);
if (mtimeList[filenum] != sb.st_mtime)
*result |= RPMVERIFY_MTIME;
}
if (flags & RPMVERIFY_USER) {
if (headerGetEntry(h, RPMTAG_FILEUSERNAME, NULL, (void **) &unameList,
NULL)) {
const char * name;
const char ** unameList;
int_32 * uidList;
int unt;
if (hge(h, RPMTAG_FILEUSERNAME, &unt, (void **) &unameList, NULL)) {
name = uidToUname(sb.st_uid);
if (!name || strcmp(unameList[filenum], name))
*result |= RPMVERIFY_USER;
free(unameList);
} else if (headerGetEntry(h, RPMTAG_FILEUIDS, NULL, (void **) &uidList,
&count)) {
unameList = hfd(unameList, unt);
} else if (hge(h, RPMTAG_FILEUIDS, NULL, (void **) &uidList, NULL)) {
if (uidList[filenum] != sb.st_uid)
*result |= RPMVERIFY_GROUP;
} else {
@ -253,14 +269,17 @@ int rpmVerifyFile(const char * prefix, Header h, int filenum,
}
if (flags & RPMVERIFY_GROUP) {
if (headerGetEntry(h, RPMTAG_FILEGROUPNAME, NULL, (void **) &gnameList,
NULL)) {
rc = gnameToGid(gnameList[filenum],&gid);
const char ** gnameList;
int_32 * gidList;
int gnt;
gid_t gid;
if (hge(h, RPMTAG_FILEGROUPNAME, &gnt, (void **) &gnameList, NULL)) {
rc = gnameToGid(gnameList[filenum], &gid);
if (rc || (gid != sb.st_gid))
*result |= RPMVERIFY_GROUP;
free(gnameList);
} else if (headerGetEntry(h, RPMTAG_FILEGIDS, NULL, (void **) &gidList,
&count)) {
gnameList = hfd(gnameList, gnt);
} else if (hge(h, RPMTAG_FILEGIDS, NULL, (void **) &gidList, NULL)) {
if (gidList[filenum] != sb.st_gid)
*result |= RPMVERIFY_GROUP;
} else {
@ -309,6 +328,7 @@ int rpmVerifyScript(const char * rootDir, Header h, FD_t scriptFd)
/* ======================================================================== */
static int verifyHeader(QVA_t *qva, Header h)
{
HGE_t hge = (HGE_t)headerGetEntryMinMemory;
char buf[BUFSIZ];
char * t, * te;
@ -324,7 +344,7 @@ static int verifyHeader(QVA_t *qva, Header h)
te = t = buf;
*te = '\0';
if (!headerGetEntry(h, RPMTAG_FILEFLAGS, NULL, (void **) &fileFlagsList, NULL))
if (!hge(h, RPMTAG_FILEFLAGS, NULL, (void **) &fileFlagsList, NULL))
goto exit;
if (!headerIsEntry(h, RPMTAG_BASENAMES))
@ -400,16 +420,16 @@ static int verifyDependencies(rpmdb rpmdb, Header h)
int i;
rpmdep = rpmtransCreateSet(rpmdb, NULL);
rpmtransAddPackage(rpmdep, h, NULL, NULL, 0, NULL);
(void) rpmtransAddPackage(rpmdep, h, NULL, NULL, 0, NULL);
rpmdepCheck(rpmdep, &conflicts, &numConflicts);
(void) rpmdepCheck(rpmdep, &conflicts, &numConflicts);
rpmtransFree(rpmdep);
if (numConflicts) {
const char * name, * version, * release;
char * t, * te;
int nb = 512;
headerNVR(h, &name, &version, &release);
(void) headerNVR(h, &name, &version, &release);
for (i = 0; i < numConflicts; i++) {
nb += strlen(conflicts[i].needsName) + sizeof(", ") - 1;
@ -463,7 +483,7 @@ int showVerifyPackage(QVA_t *qva, rpmdb rpmdb, Header h)
if ((qva->qva_flags & VERIFY_SCRIPT) &&
(rc = rpmVerifyScript(qva->qva_prefix, h, fdo)) != 0)
ec = rc;
Fclose(fdo);
(void) Fclose(fdo);
return ec;
}
@ -486,7 +506,7 @@ int rpmVerify(QVA_t *qva, rpmQVSources source, const char *arg)
rc = rpmQueryVerify(qva, source, arg, rpmdb, showVerifyPackage);
if (rpmdb != NULL)
rpmdbClose(rpmdb);
(void) rpmdbClose(rpmdb);
return rc;
}

1116
po/rpm.pot

File diff suppressed because it is too large Load Diff

View File

@ -9,18 +9,12 @@
# don't-bother-me-yet parameters
#-branchstate
#-immediatetrans
-mustfree
#-observertrans
#-statictrans
# not-yet normal parameters
-boolops # w->n
-fixedformalarray
-null
#-null
-predboolint # w->n
-predboolothers # w->n
-retvalint # w->n
-type

View File

@ -12,21 +12,15 @@
# don't-bother-me-yet parameters
-branchstate # ~43 occurences
#-immediatetrans
-mustfree # alloca is painful
#-observertrans
#-statictrans
-mustfree # ~122 alloca is painful
# not-yet normal parameters
-boolops # w->n
#-fixedformalarray
-null # ugh
-predboolint # w->n ~144
#-predboolothers # w->n ~8
-retvalint # w->n ~48
-type # ~449
-boolops # ~244 w->n
#-null # ~84
-predboolint # ~147 w->n
-type # ~373
# not-yet -weak paramaters
# -weak paramaters
#+boolint
#-boolops
#+ignorequals

View File

@ -453,14 +453,18 @@ rpmDigestUpdate(DIGEST_CTX ctx, const void * data, size_t len)
/* Process data in ctx->datalen chunks */
for (; len >= ctx->datalen; buf += ctx->datalen, len -= ctx->datalen) {
/*@-mayaliasunique@*/
memcpy(ctx->in, buf, ctx->datalen);
/*@=mayaliasunique@*/
if (ctx->doByteReverse)
byteReverse(ctx->in, ctx->datalen);
ctx->transform(ctx);
}
/* Handle any remaining bytes of data. */
/*@-mayaliasunique@*/
memcpy(ctx->in, buf, len);
/*@=mayaliasunique@*/
}
void

View File

@ -214,7 +214,9 @@ findEntry(MacroContext *mc, const char *name, size_t namelen)
key = &keybuf;
memset(key, 0, sizeof(*key));
/*@-temptrans@*/
key->name = (char *)name;
/*@=temptrans@*/
ret = (MacroEntry **)bsearch(&key, mc->macroTable, mc->firstFree,
sizeof(*(mc->macroTable)), compareMacroName);
/* XXX TODO: find 1st empty slot and return that */
@ -466,7 +468,9 @@ expandU(MacroBuf *mb, char *u, size_t ulen)
tbuf = alloca(ulen + 1);
memset(tbuf, 0, (ulen + 1));
/*@-temptrans@*/
mb->s = u;
/*@=temptrans@*/
mb->t = tbuf;
mb->nb = ulen;
rc = expandMacro(mb);
@ -507,7 +511,7 @@ doShellEscape(MacroBuf *mb, const char *cmd, size_t clen)
return 1;
while(mb->nb > 0 && (c = fgetc(shf)) != EOF)
SAVECHAR(mb, c);
pclose(shf);
(void) pclose(shf);
/* XXX delete trailing \r \n */
while (iseol(mb->t[-1])) {
@ -686,11 +690,13 @@ popMacro(MacroEntry **mep)
if (me) {
/* XXX cast to workaround const */
/*@-onlytrans@*/
if ((*mep = me->prev) == NULL)
FREE(me->name);
FREE(me->opts);
FREE(me->body);
FREE(me);
/*@=onlytrans@*/
}
}
@ -817,7 +823,7 @@ grabArgs(MacroBuf *mb, const MacroEntry *me, const char *se, char lastc)
while((c = getopt(argc, (char **)argv, opts)) != -1) {
if (c == '?' || (o = strchr(opts, c)) == NULL) {
rpmError(RPMERR_BADSPEC, _("Unknown option %c in %s(%s)\n"),
c, me->name, opts);
(char)c, me->name, opts);
return se;
}
*be++ = '-';
@ -869,7 +875,7 @@ doOutput(MacroBuf *mb, int waserror, const char *msg, size_t msglen)
strncpy(buf, msg, msglen);
buf[msglen] = '\0';
expandU(mb, buf, sizeof(buf));
(void) expandU(mb, buf, sizeof(buf));
if (waserror)
rpmError(RPMERR_BADSPEC, "%s\n", buf);
else
@ -895,7 +901,7 @@ doFoo(MacroBuf *mb, int negate, const char *f, size_t fn, const char *g, size_t
if (g) {
strncpy(buf, g, glen);
buf[glen] = '\0';
expandU(mb, buf, sizeof(buf));
(void) expandU(mb, buf, sizeof(buf));
}
if (STREQ("basename", f, fn)) {
if ((b = strrchr(buf, '/')) == NULL)
@ -928,7 +934,7 @@ doFoo(MacroBuf *mb, int negate, const char *f, size_t fn, const char *g, size_t
be++;
*be++ = '\0';
#ifndef DEBUG_MACROS
isCompressed(b, &compressed);
(void) isCompressed(b, &compressed);
#endif
switch(compressed) {
default:
@ -968,7 +974,7 @@ doFoo(MacroBuf *mb, int negate, const char *f, size_t fn, const char *g, size_t
}
if (b) {
expandT(mb, b, strlen(b));
(void) expandT(mb, b, strlen(b));
}
}
@ -1063,7 +1069,7 @@ expandMacro(MacroBuf *mb)
case '(': /* %(...) shell escape */
if ((se = matchchar(s, c, ')')) == NULL) {
rpmError(RPMERR_BADSPEC,
_("Unterminated %c: %s\n"), c, s);
_("Unterminated %c: %s\n"), (char)c, s);
rc = 1;
continue;
}
@ -1080,7 +1086,7 @@ expandMacro(MacroBuf *mb)
case '{': /* %{...}/%{...:...} substitution */
if ((se = matchchar(s, c, '}')) == NULL) {
rpmError(RPMERR_BADSPEC,
_("Unterminated %c: %s\n"), c, s);
_("Unterminated %c: %s\n"), (char)c, s);
rc = 1;
continue;
}
@ -1268,7 +1274,9 @@ expandMacro(MacroBuf *mb)
/* Recursively expand body of macro */
if (me->body && *me->body) {
/*@-onlytrans@*/
mb->s = me->body;
/*@=onlytrans@*/
rc = expandMacro(mb);
if (rc == 0)
me->used++; /* Mark macro as used */
@ -1306,15 +1314,19 @@ expandMacros(void *spec, MacroContext *mc, char *s, size_t slen)
tbuf = alloca(slen + 1);
memset(tbuf, 0, (slen + 1));
/*@-temptrans@*/
mb->s = s;
/*@=temptrans@*/
mb->t = tbuf;
mb->nb = slen;
mb->depth = 0;
mb->macro_trace = print_macro_trace;
mb->expand_trace = print_expand_trace;
/*@-temptrans@*/
mb->spec = spec; /* (future) %file expansion info */
mb->mc = mc;
/*@=temptrans@*/
rc = expandMacro(mb);
@ -1373,7 +1385,9 @@ rpmDefineMacro(MacroContext *mc, const char *macro, int level)
memset(mb, 0, sizeof(*mb));
/* XXX just enough to get by */
/*@-temptrans@*/
mb->mc = (mc ? mc : &rpmGlobalMacroContext);
/*@=temptrans@*/
(void)doDefine(mb, macro, level, 0);
return 0;
}
@ -1436,7 +1450,7 @@ rpmInitMacros(MacroContext *mc, const char *macrofiles)
fd = Fopen(buf, "r.fpio");
if (fd == NULL || Ferror(fd)) {
if (fd) Fclose(fd);
if (fd) (void) Fclose(fd);
continue;
}
@ -1454,15 +1468,18 @@ rpmInitMacros(MacroContext *mc, const char *macrofiles)
n++; /* skip % */
(void)rpmDefineMacro(NULL, n, RMIL_MACROFILES);
}
Fclose(fd);
(void) Fclose(fd);
}
if (m)
if (m) {
free(m);
m = NULL;
}
/* Reload cmdline macros */
rpmLoadMacros(&rpmCLIMacroContext, RMIL_CMDLINE);
}
/*@-globstate@*/
void
rpmFreeMacros(MacroContext *mc)
{
@ -1475,8 +1492,10 @@ rpmFreeMacros(MacroContext *mc)
MacroEntry *me;
while ((me = mc->macroTable[i]) != NULL) {
/* XXX cast to workaround const */
/*@-onlytrans@*/
if ((mc->macroTable[i] = me->prev) == NULL)
FREE(me->name);
/*@=onlytrans@*/
FREE(me->opts);
FREE(me->body);
FREE(me);
@ -1485,6 +1504,7 @@ rpmFreeMacros(MacroContext *mc)
FREE(mc->macroTable);
memset(mc, 0, sizeof(*mc));
}
/*@=globstate@*/
/* =============================================================== */
int isCompressed(const char *file, rpmCompressedMagic *compressed)
@ -1500,7 +1520,7 @@ int isCompressed(const char *file, rpmCompressedMagic *compressed)
if (fd == NULL || Ferror(fd)) {
/* XXX Fstrerror */
rpmError(RPMERR_BADSPEC, _("File %s: %s\n"), file, Fstrerror(fd));
if (fd) Fclose(fd);
if (fd) (void) Fclose(fd);
return 1;
}
nb = Fread(magic, sizeof(char), sizeof(magic), fd);
@ -1512,7 +1532,7 @@ int isCompressed(const char *file, rpmCompressedMagic *compressed)
file, (unsigned)sizeof(magic));
rc = 0;
}
Fclose(fd);
(void) Fclose(fd);
if (rc >= 0)
return rc;
@ -1555,7 +1575,7 @@ rpmExpand(const char *arg, ...)
while ((s = va_arg(ap, const char *)) != NULL)
pe = stpcpy(pe, s);
va_end(ap);
expandMacros(NULL, NULL, buf, sizeof(buf));
(void) expandMacros(NULL, NULL, buf, sizeof(buf));
return xstrdup(buf);
}
@ -1661,7 +1681,7 @@ char *rpmCleanPath(char * path)
*t = '\0';
/*fprintf(stderr, "\t%s\n", path); */
return path;
/*@-temptrans@*/ return path; /*@=temptrans@*/
}
/* Return concatenated and expanded canonical path. */
@ -1688,7 +1708,7 @@ rpmGetPath(const char *path, ...)
*te = '\0';
}
va_end(ap);
expandMacros(NULL, NULL, buf, sizeof(buf));
(void) expandMacros(NULL, NULL, buf, sizeof(buf));
(void) rpmCleanPath(buf);
return xstrdup(buf); /* XXX xstrdup has side effects. */

View File

@ -278,7 +278,7 @@ static inline /*@null@*/ FD_t XfdNew(const char *msg, const char *file, unsigned
fd->errcookie = NULL;
fd->stats = xcalloc(1, sizeof(*fd->stats));
fd->digest = NULL;
gettimeofday(&fd->stats->create, NULL);
(void) gettimeofday(&fd->stats->create, NULL);
fd->stats->begin = fd->stats->create; /* structure assignment */
fd->ftpFileDoneNeeded = 0;
@ -352,7 +352,7 @@ static inline int fdSeek(void * cookie, _libio_pos_t pos, int whence) {
rc = lseek(fdFileno(fd), p, whence);
fdstat_exit(fd, FDSTAT_SEEK, rc);
DBGIO(fd, (stderr, "==>\tfdSeek(%p,%ld,%d) rc %lx %s\n", cookie, (long)p, whence, (long)rc, fdbg(fd)));
DBGIO(fd, (stderr, "==>\tfdSeek(%p,%ld,%d) rc %lx %s\n", cookie, (long)p, whence, (unsigned long)rc, fdbg(fd)));
return rc;
}
@ -372,7 +372,7 @@ int fdClose( /*@only@*/ void * cookie) {
rc = ((fdno >= 0) ? close(fdno) : -2);
fdstat_exit(fd, FDSTAT_CLOSE, rc);
DBGIO(fd, (stderr, "==>\tfdClose(%p) rc %lx %s\n", fd, (long)rc, fdbg(fd)));
DBGIO(fd, (stderr, "==>\tfdClose(%p) rc %lx %s\n", fd, (unsigned long)rc, fdbg(fd)));
fd = fdFree(fd, "open (fdClose)");
return rc;
@ -387,7 +387,7 @@ DBGIO(fd, (stderr, "==>\tfdClose(%p) rc %lx %s\n", fd, (long)rc, fdbg(fd)));
fd = fdNew("open (fdOpen)");
fdSetFdno(fd, fdno);
fd->flags = flags;
DBGIO(fd, (stderr, "==>\tfdOpen(\"%s\",%x,0%o) %s\n", path, flags, (unsigned)mode, fdbg(fd)));
DBGIO(fd, (stderr, "==>\tfdOpen(\"%s\",%x,0%o) %s\n", path, (unsigned)flags, (unsigned)mode, fdbg(fd)));
/*@-refcounttrans@*/ return fd; /*@=refcounttrans@*/
}
@ -418,7 +418,9 @@ int fdWritable(FD_t fd, int secs)
tvp->tv_usec = 0;
}
errno = 0;
/*@-compdef@*/
rc = select(fdno + 1, NULL, &wrfds, NULL, tvp);
/*@=compdef@*/
if (_rpmio_debug && !(rc == 1 && errno == 0))
fprintf(stderr, "*** fdWritable fdno %d rc %d %s\n", fdno, rc, strerror(errno));
@ -456,7 +458,9 @@ int fdReadable(FD_t fd, int secs)
tvp->tv_usec = 0;
}
errno = 0;
/*@-compdef@*/
rc = select(fdno + 1, &rdfds, NULL, NULL, tvp);
/*@=compdef@*/
if (rc < 0) {
switch (errno) {
@ -619,25 +623,25 @@ static int mygethostbyname(const char * host, struct in_addr * address)
static int getHostAddress(const char * host, struct in_addr * address)
{
if (xisdigit(host[0])) {
if (! /*@-unrecog@*/ inet_aton(host, address) /*@=unrecog@*/ ) {
return FTPERR_BAD_HOST_ADDR;
}
if (! /*@-unrecog@*/ inet_aton(host, address) /*@=unrecog@*/ )
return FTPERR_BAD_HOST_ADDR;
} else {
if (mygethostbyname(host, address)) {
errno = h_errno;
return FTPERR_BAD_HOSTNAME;
}
if (mygethostbyname(host, address)) {
errno = /*@-unrecog@*/ h_errno /*@=unrecog@*/;
return FTPERR_BAD_HOSTNAME;
}
}
return 0;
}
static int tcpConnect(FD_t ctrl, const char *host, int port)
static int tcpConnect(FD_t ctrl, const char * host, int port)
{
struct sockaddr_in sin;
int fdno = -1;
int rc;
memset(&sin, 0, sizeof(sin));
sin.sin_family = AF_INET;
sin.sin_port = htons(port);
sin.sin_addr.s_addr = INADDR_ANY;
@ -669,9 +673,11 @@ ntohs(sin.sin_port), fdno);
return 0;
errxit:
/*@-observertrans@*/
fdSetSyserrno(ctrl, errno, ftpStrerror(rc));
/*@=observertrans@*/
if (fdno >= 0)
close(fdno);
(void) close(fdno);
return rc;
}
@ -929,8 +935,9 @@ static int ftpLogin(urlinfo u)
}
if (fdFileno(u->ctrl) >= 0 && fdWritable(u->ctrl, 0) < 1)
fdClose(u->ctrl);
/*@-refcounttrans@*/ (void) fdClose(u->ctrl); /*@=refcounttrans@*/
/*@-usereleased@*/
if (fdFileno(u->ctrl) < 0) {
rc = tcpConnect(u->ctrl, host, port);
if (rc < 0)
@ -949,14 +956,21 @@ static int ftpLogin(urlinfo u)
if ((rc = ftpCommand(u, NULL, "TYPE", "I", NULL)))
goto errxit;
/*@-compdef@*/
return 0;
/*@=compdef@*/
errxit:
/*@-observertrans@*/
fdSetSyserrno(u->ctrl, errno, ftpStrerror(rc));
/*@=observertrans@*/
errxit2:
if (fdFileno(u->ctrl) >= 0)
fdClose(u->ctrl);
/*@-refcounttrans@*/ (void) fdClose(u->ctrl); /*@=refcounttrans@*/
/*@-compdef@*/
return rc;
/*@=compdef@*/
/*@=usereleased@*/
}
int ftpReq(FD_t data, const char * ftpCmd, const char * ftpArg)
@ -1028,6 +1042,7 @@ int ftpReq(FD_t data, const char * ftpCmd, const char * ftpArg)
port number portion */
{ int i, j;
memset(&dataAddress, 0, sizeof(dataAddress));
dataAddress.sin_family = AF_INET;
if (sscanf(chptr, "%d,%d", &i, &j) != 2) {
rc = FTPERR_PASSIVE_ERROR;
@ -1083,9 +1098,11 @@ fprintf(stderr, "-> %s", cmd);
return 0;
errxit:
/*@-observertrans@*/
fdSetSyserrno(u->ctrl, errno, ftpStrerror(rc));
/*@=observertrans@*/
if (fdFileno(data) >= 0)
fdClose(data);
/*@-refcounttrans@*/ (void) fdClose(data); /*@=refcounttrans@*/
return rc;
}
@ -1200,7 +1217,7 @@ int ufdGetFile(FD_t sfd, FD_t tfd)
FDSANE(sfd);
FDSANE(tfd);
rc = ufdCopy(sfd, tfd);
Fclose(sfd);
(void) Fclose(sfd);
if (rc > 0) /* XXX ufdCopy now returns no. bytes copied */
rc = 0;
return rc;
@ -1253,14 +1270,15 @@ static int ftpAbort(urlinfo u, FD_t data) {
DBGIO(0, (stderr, "-> ABOR\n"));
/*@-usereleased -compdef@*/
if (send(fdFileno(ctrl), ipbuf, sizeof(ipbuf), MSG_OOB) != sizeof(ipbuf)) {
fdClose(ctrl);
/*@-refcounttrans@*/ (void) fdClose(ctrl); /*@=refcounttrans@*/
return FTPERR_SERVER_IO_ERROR;
}
sprintf(u->buf, "%cABOR\r\n",(char) DM);
if (fdWrite(ctrl, u->buf, 7) != 7) {
fdClose(ctrl);
/*@-refcounttrans@*/ (void) fdClose(ctrl); /*@=refcounttrans@*/
return FTPERR_SERVER_IO_ERROR;
}
@ -1274,8 +1292,8 @@ static int ftpAbort(urlinfo u, FD_t data) {
}
data->rd_timeoutsecs = tosecs;
/* XXX ftp abort needs to close the data channel to receive status */
shutdown(fdFileno(data), SHUT_RDWR);
close(fdFileno(data));
(void) shutdown(fdFileno(data), SHUT_RDWR);
(void) close(fdFileno(data));
data->fps[0].fdno = -1; /* XXX WRONG but expedient */
}
@ -1289,6 +1307,7 @@ static int ftpAbort(urlinfo u, FD_t data) {
u->ctrl->rd_timeoutsecs = tosecs;
return rc;
/*@=usereleased =compdef@*/
}
static int ftpFileDone(urlinfo u, FD_t data)
@ -1351,9 +1370,10 @@ static int httpReq(FD_t ctrl, const char * httpCmd, const char * httpArg)
reopen:
if (fdFileno(ctrl) >= 0 && (rc = fdWritable(ctrl, 0)) < 1) {
fdClose(ctrl);
/*@-refcounttrans@*/ (void) fdClose(ctrl); /*@=refcounttrans@*/
}
/*@-usereleased@*/
if (fdFileno(ctrl) < 0) {
rc = tcpConnect(ctrl, host, port);
if (rc < 0)
@ -1410,7 +1430,7 @@ fprintf(stderr, "-> %s", req);
if (rc) {
if (!retrying) { /* not HTTP_OK */
retrying = 1;
fdClose(ctrl);
/*@-refcounttrans@*/ (void) fdClose(ctrl); /*@=refcounttrans@*/
goto reopen;
}
goto errxit;
@ -1421,11 +1441,14 @@ fprintf(stderr, "-> %s", req);
return 0;
errxit:
/*@-observertrans@*/
fdSetSyserrno(ctrl, errno, ftpStrerror(rc));
/*@=observertrans@*/
errxit2:
if (fdFileno(ctrl) >= 0)
fdClose(ctrl);
/*@-refcounttrans@*/ (void) fdClose(ctrl); /*@=refcounttrans@*/
return rc;
/*@=usereleased@*/
}
/* XXX DYING: unused */
@ -1446,7 +1469,7 @@ static ssize_t ufdRead(void * cookie, /*@out@*/ char * buf, size_t count) {
if (fdGetIo(fd) == fdio) {
struct stat sb;
int fdno = fdFileno(fd);
fstat(fdno, &sb);
(void) fstat(fdno, &sb);
if (S_ISREG(sb.st_mode))
return fdRead(fd, buf, count);
}
@ -1506,7 +1529,7 @@ static ssize_t ufdWrite(void * cookie, const char * buf, size_t count)
#ifdef NOTYET
if (fdGetIo(fd) == fdio) {
struct stat sb;
fstat(fdGetFdno(fd), &sb);
(void) fstat(fdGetFdno(fd), &sb);
if (S_ISREG(sb.st_mode))
return fdWrite(fd, buf, count);
}
@ -1624,9 +1647,9 @@ int ufdClose( /*@only@*/ void * cookie)
if (fd->bytesRemain > 0) {
if (fd->ftpFileDoneNeeded) {
if (fdReadable(u->ctrl, 0) > 0)
ftpFileDone(u, fd);
(void) ftpFileDone(u, fd);
else
ftpAbort(u, fd);
(void) ftpAbort(u, fd);
}
} else {
int rc;
@ -1636,7 +1659,7 @@ int ufdClose( /*@only@*/ void * cookie)
assert(fd->ftpFileDoneNeeded != 0);
#endif
if (fd->ftpFileDoneNeeded)
ftpFileDone(u, fd);
(void) ftpFileDone(u, fd);
return rc;
}
}
@ -1726,8 +1749,8 @@ exit:
return fd;
}
static /*@null@*/ FD_t httpOpen(const char *url, int flags, mode_t mode,
/*@out@*/ urlinfo *uret)
static /*@null@*/ FD_t httpOpen(const char * url, /*@unused@*/ int flags,
/*@unused@*/ mode_t mode, /*@out@*/ urlinfo * uret)
{
urlinfo u = NULL;
FD_t fd = NULL;
@ -1775,7 +1798,7 @@ static /*@null@*/ FD_t ufdOpen(const char *url, int flags, mode_t mode)
urltype urlType = urlPath(url, &path);
if (_rpmio_debug)
fprintf(stderr, "*** ufdOpen(%s,0x%x,0%o)\n", url, flags, (unsigned)mode);
fprintf(stderr, "*** ufdOpen(%s,0x%x,0%o)\n", url, (unsigned)flags, (unsigned)mode);
switch (urlType) {
case URL_IS_FTP:
@ -1843,10 +1866,10 @@ fprintf(stderr, "*** ufdOpen(%s,0x%x,0%o)\n", url, flags, (unsigned)mode);
if (fd == NULL) return NULL;
fd->urlType = urlType;
if (Fileno(fd) < 0) {
ufdClose(fd);
(void) ufdClose(fd);
return NULL;
}
DBGIO(fd, (stderr, "==>\tufdOpen(\"%s\",%x,0%o) %s\n", url, flags, (unsigned)mode, fdbg(fd)));
DBGIO(fd, (stderr, "==>\tufdOpen(\"%s\",%x,0%o) %s\n", url, (unsigned)flags, (unsigned)mode, fdbg(fd)));
return fd;
}
@ -1922,7 +1945,7 @@ static ssize_t gzdRead(void * cookie, /*@out@*/ char * buf, size_t count) {
gzfile = gzdFileno(fd);
fdstat_enter(fd, FDSTAT_READ);
rc = gzread(gzfile, buf, count);
DBGIO(fd, (stderr, "==>\tgzdRead(%p,%p,%u) rc %lx %s\n", cookie, buf, (unsigned)count, (long)rc, fdbg(fd)));
DBGIO(fd, (stderr, "==>\tgzdRead(%p,%p,%u) rc %lx %s\n", cookie, buf, (unsigned)count, (unsigned long)rc, fdbg(fd)));
if (rc < 0) {
int zerror = 0;
fd->errcookie = gzerror(gzfile, &zerror);
@ -1949,7 +1972,7 @@ static ssize_t gzdWrite(void * cookie, const char * buf, size_t count) {
gzfile = gzdFileno(fd);
fdstat_enter(fd, FDSTAT_WRITE);
rc = gzwrite(gzfile, (void *)buf, count);
DBGIO(fd, (stderr, "==>\tgzdWrite(%p,%p,%u) rc %lx %s\n", cookie, buf, (unsigned)count, (long)rc, fdbg(fd)));
DBGIO(fd, (stderr, "==>\tgzdWrite(%p,%p,%u) rc %lx %s\n", cookie, buf, (unsigned)count, (unsigned long)rc, fdbg(fd)));
if (rc < 0) {
int zerror = 0;
fd->errcookie = gzerror(gzfile, &zerror);
@ -1979,7 +2002,7 @@ static inline int gzdSeek(void * cookie, _libio_pos_t pos, int whence) {
gzfile = gzdFileno(fd);
fdstat_enter(fd, FDSTAT_SEEK);
rc = gzseek(gzfile, p, whence);
DBGIO(fd, (stderr, "==>\tgzdSeek(%p,%ld,%d) rc %lx %s\n", cookie, (long)p, whence, (long)rc, fdbg(fd)));
DBGIO(fd, (stderr, "==>\tgzdSeek(%p,%ld,%d) rc %lx %s\n", cookie, (long)p, whence, (unsigned long)rc, fdbg(fd)));
if (rc < 0) {
int zerror = 0;
fd->errcookie = gzerror(gzfile, &zerror);
@ -2022,7 +2045,7 @@ DBGIO(fd, (stderr, "==>\tgzdClose(%p) zerror %d %s\n", cookie, rc, fdbg(fd)));
}
}
DBGIO(fd, (stderr, "==>\tgzdClose(%p) rc %lx %s\n", cookie, (long)rc, fdbg(fd)));
DBGIO(fd, (stderr, "==>\tgzdClose(%p) rc %lx %s\n", cookie, (unsigned long)rc, fdbg(fd)));
if (_rpmio_debug || rpmIsDebug()) fdstat_print(fd, "GZDIO", stderr);
if (rc == 0)
@ -2174,7 +2197,7 @@ static int bzdClose( /*@only@*/ void * cookie) {
}
}
DBGIO(fd, (stderr, "==>\tbzdClose(%p) rc %lx %s\n", cookie, (long)rc, fdbg(fd)));
DBGIO(fd, (stderr, "==>\tbzdClose(%p) rc %lx %s\n", cookie, (unsigned long)rc, fdbg(fd)));
if (_rpmio_debug || rpmIsDebug()) fdstat_print(fd, "BZDIO", stderr);
if (rc == 0)
@ -2322,9 +2345,12 @@ DBGIO(fd, (stderr, "==> Fclose(%p) %s\n", fd, fdbg(fd)));
fd->fps[fd->nfps-1].fp == fp &&
fd->fps[fd->nfps-1].fdno >= 0)
{
fflush(fp);
(void) fflush(fp);
fd->nfps--;
/*@-refcounttrans@*/
rc = ufdClose(fd);
/*@=refcounttrans@*/
/*@-usereleased@*/
if (fdGetFdno(fd) >= 0)
break;
fdSetFp(fd, NULL);
@ -2352,6 +2378,7 @@ DBGIO(fd, (stderr, "==> Fclose(%p) %s\n", fd, fdbg(fd)));
}
fd = fdFree(fd, "Fclose");
return ec;
/*@=usereleased@*/
}
/*
@ -2452,7 +2479,7 @@ fprintf(stderr, "*** Fdopen(%p,%s) %s\n", fd, fmode, fdbg(fd));
strncat(zstdio, other, sizeof(zstdio) - strlen(zstdio));
if (end == NULL && other[0] == '\0')
return fd;
/*@-refcounttrans@*/ return fd; /*@=refcounttrans@*/
if (end && *end) {
if (!strcmp(end, "fdio")) {
@ -2474,14 +2501,18 @@ fprintf(stderr, "*** Fdopen(%p,%s) %s\n", fd, fmode, fdbg(fd));
if (noLibio) {
int fdno = Fileno(fd);
FILE * fp = fdopen(fdno, stdio);
/*@+voidabstract@*/
if (_rpmio_debug)
fprintf(stderr, "*** Fdopen fpio fp %p\n", fp);
fprintf(stderr, "*** Fdopen fpio fp %p\n", (void *)fp);
/*@=voidabstract@*/
if (fp == NULL)
return NULL;
/* XXX gzdio/bzdio use fp for private data */
/*@+voidabstract@*/
if (fdGetFp(fd) == NULL)
fdSetFp(fd, fp);
fdPush(fd, fpio, fp, fdno); /* Push fpio onto stack */
/*@=voidabstract@*/
}
}
} else if (other[0] != '\0') {
@ -2493,7 +2524,7 @@ fprintf(stderr, "*** Fdopen fpio fp %p\n", fp);
}
}
if (iof == NULL)
return fd;
/*@-refcounttrans@*/ return fd; /*@=refcounttrans@*/
if (!noLibio) {
FILE * fp = NULL;
@ -2511,15 +2542,17 @@ DBGIO(fd, (stderr, "==> fopencookie(%p,\"%s\",*%p) returns fp %p\n", fd, stdio,
if (fp) {
/* XXX gzdio/bzdio use fp for private data */
/*@+voidabstract@*/
if (fdGetFp(fd) == NULL)
fdSetFp(fd, fp);
fdPush(fd, fpio, fp, fileno(fp)); /* Push fpio onto stack */
/*@=voidabstract@*/
fd = fdLink(fd, "fopencookie");
}
}
DBGIO(fd, (stderr, "==> Fdopen(%p,\"%s\") returns fd %p %s\n", ofd, fmode, fd, fdbg(fd)));
return fd;
/*@-refcounttrans@*/ return fd; /*@=refcounttrans@*/
}
FD_t Fopen(const char *path, const char *fmode)
@ -2542,7 +2575,7 @@ if (_rpmio_debug)
fprintf(stderr, "*** Fopen fdio path %s fmode %s\n", path, fmode);
fd = fdOpen(path, flags, perms);
if (fdFileno(fd) < 0) {
fdClose(fd);
(void) fdClose(fd);
return NULL;
}
} else if (!strcmp(end, "fadio")) {
@ -2550,7 +2583,7 @@ if (_rpmio_debug)
fprintf(stderr, "*** Fopen fadio path %s fmode %s\n", path, fmode);
fd = fadio->_open(path, flags, perms);
if (fdFileno(fd) < 0) {
fdClose(fd);
/*@-refcounttrans@*/ (void) fdClose(fd); /*@=refcounttrans@*/
return NULL;
}
} else {
@ -2583,7 +2616,9 @@ fprintf(stderr, "*** Fopen WTFO path %s fmode %s\n", path, fmode);
/* XXX persistent HTTP/1.1 returns the previously opened fp */
if (isHTTP && ((fp = fdGetFp(fd)) != NULL) && ((fdno = fdGetFdno(fd)) >= 0)) {
/*@+voidabstract@*/
fdPush(fd, fpio, fp, fileno(fp)); /* Push fpio onto stack */
/*@=voidabstract@*/
return fd;
}
}

View File

@ -13,9 +13,12 @@
/*@access FD_t@*/
/*@-redef@*/
int fdFileno(void * cookie); /* Yet Another Prototype. */
int fdFileno(void * cookie) {
FD_t fd;
if (cookie == NULL) return -2;
fd = c2f(cookie);
return fd->fps[0].fdno;
}
/*@=redef@*/

View File

@ -235,7 +235,7 @@ int ufdClose( /*@only@*/ void * cookie);
{
if (fd->stats == NULL) return;
fd->stats->ops[opx].count++;
gettimeofday(&fd->stats->begin, NULL);
(void) gettimeofday(&fd->stats->begin, NULL);
}
/** \ingroup rpmio
@ -259,7 +259,7 @@ int ufdClose( /*@only@*/ void * cookie);
struct timeval end;
if (rc == -1) fd->syserrno = errno;
if (fd->stats == NULL) return;
gettimeofday(&end, NULL);
(void) gettimeofday(&end, NULL);
if (rc >= 0) {
switch(opx) {
case FDSTAT_SEEK:

View File

@ -179,10 +179,10 @@ static void vrpmlog (unsigned code, const char *fmt, va_list ap)
}
if (rpmlogMsgPrefix[pri] && *rpmlogMsgPrefix[pri])
fputs(_(rpmlogMsgPrefix[pri]), msgout);
(void) fputs(_(rpmlogMsgPrefix[pri]), msgout);
fputs(msg, msgout);
fflush(msgout);
(void) fputs(msg, msgout);
(void) fflush(msgout);
if (freeMsgbuf)
free(msgbuf);
if (pri <= RPMLOG_CRIT)

View File

@ -277,79 +277,83 @@ static int
is_dos_date(char *str)
{
if (strlen(str) == 8 && str[2] == str[5] && strchr("\\-/", (int)str[2]) != NULL)
return (1);
return 1;
return (0);
return 0;
}
static int
is_week (char *str, struct tm *tim)
is_week (const char * str, /*@out@*/ struct tm * tim)
{
static char *week = "SunMonTueWedThuFriSat";
char *pos;
/*@observer@*/ static const char * week = "SunMonTueWedThuFriSat";
const char * pos;
if((pos=strstr(week, str)) != NULL){
if(tim != NULL)
/*@-observertrans -mayaliasunique@*/
if ((pos=strstr(week, str)) != NULL) {
/*@=observertrans =mayaliasunique@*/
if (tim != NULL)
tim->tm_wday = (pos - week)/3;
return (1);
return 1;
}
return (0);
return 0;
}
static int
is_month (char *str, struct tm *tim)
is_month (const char * str, /*@out@*/ struct tm * tim)
{
static char *month = "JanFebMarAprMayJunJulAugSepOctNovDec";
char *pos;
/*@observer@*/ static const char * month = "JanFebMarAprMayJunJulAugSepOctNovDec";
const char * pos;
if((pos=strstr(month, str)) != NULL){
if(tim != NULL)
/*@-observertrans -mayaliasunique@*/
if ((pos=strstr(month, str)) != NULL) {
/*@=observertrans -mayaliasunique@*/
if (tim != NULL)
tim->tm_mon = (pos - month)/3;
return (1);
return 1;
}
return (0);
return 0;
}
static int
is_time (char *str, struct tm *tim)
is_time (const char * str, /*@out@*/ struct tm * tim)
{
char *p, *p2;
const char * p, * p2;
if ((p=strchr(str, ':')) && (p2=strrchr(str, ':'))) {
if (p != p2) {
if (sscanf (str, "%2d:%2d:%2d", &tim->tm_hour, &tim->tm_min, &tim->tm_sec) != 3)
return (0);
return 0;
}
else {
if (sscanf (str, "%2d:%2d", &tim->tm_hour, &tim->tm_min) != 2)
return (0);
return 0;
}
}
else
return (0);
return 0;
return (1);
return 1;
}
static int is_year(char *str, struct tm *tim)
static int is_year(const char * str, /*@out@*/ struct tm * tim)
{
long year;
if (strchr(str,':'))
return (0);
return 0;
if (strlen(str)!=4)
return (0);
return 0;
if (sscanf(str, "%ld", &year) != 1)
return (0);
return 0;
if (year < 1900 || year > 3000)
return (0);
return 0;
tim->tm_year = (int) (year - 1900);
return (1);
return 1;
}
/*
@ -361,7 +365,7 @@ static int is_year(char *str, struct tm *tim)
static int
vfs_parse_filetype (char c)
{
switch (c){
switch (c) {
case 'd': return S_IFDIR;
case 'b': return S_IFBLK;
case 'c': return S_IFCHR;
@ -377,37 +381,37 @@ vfs_parse_filetype (char c)
}
}
static int vfs_parse_filemode (char *p)
static int vfs_parse_filemode (const char *p)
{ /* converts rw-rw-rw- into 0666 */
int res = 0;
switch (*(p++)){
switch (*(p++)) {
case 'r': res |= 0400; break;
case '-': break;
default: return -1;
}
switch (*(p++)){
switch (*(p++)) {
case 'w': res |= 0200; break;
case '-': break;
default: return -1;
}
switch (*(p++)){
switch (*(p++)) {
case 'x': res |= 0100; break;
case 's': res |= 0100 | S_ISUID; break;
case 'S': res |= S_ISUID; break;
case '-': break;
default: return -1;
}
switch (*(p++)){
switch (*(p++)) {
case 'r': res |= 0040; break;
case '-': break;
default: return -1;
}
switch (*(p++)){
switch (*(p++)) {
case 'w': res |= 0020; break;
case '-': break;
default: return -1;
}
switch (*(p++)){
switch (*(p++)) {
case 'x': res |= 0010; break;
case 's': res |= 0010 | S_ISGID; break;
case 'l': /* Solaris produces these */
@ -415,17 +419,17 @@ static int vfs_parse_filemode (char *p)
case '-': break;
default: return -1;
}
switch (*(p++)){
switch (*(p++)) {
case 'r': res |= 0004; break;
case '-': break;
default: return -1;
}
switch (*(p++)){
switch (*(p++)) {
case 'w': res |= 0002; break;
case '-': break;
default: return -1;
}
switch (*(p++)){
switch (*(p++)) {
case 'x': res |= 0001; break;
case 't': res |= 0001 | S_ISVTX; break;
case 'T': res |= S_ISVTX; break;
@ -482,7 +486,8 @@ static int vfs_parse_filedate(int idx, time_t *t)
if (is_dos_date(p)){
p[2] = p[5] = '-';
if(sscanf(p, "%2d-%2d-%2d", &d[0], &d[1], &d[2]) == 3){
memset(d, 0, sizeof(d));
if (sscanf(p, "%2d-%2d-%2d", &d[0], &d[1], &d[2]) == 3){
/* We expect to get:
1. MM-DD-YY
2. DD-MM-YY
@ -540,7 +545,9 @@ static int vfs_parse_filedate(int idx, time_t *t)
}
static int
vfs_parse_ls_lga (char *p, struct stat *st, char **filename, char **linkname)
vfs_parse_ls_lga (char * p, /*@out@*/ struct stat * st,
/*@out@*/ const char ** filename,
/*@out@*/ const char ** linkname)
{
int idx, idx2, num_cols;
int i;
@ -563,11 +570,13 @@ vfs_parse_ls_lga (char *p, struct stat *st, char **filename, char **linkname)
if (strlen (p) <= 8 || p [8] != ']')
goto error;
/* Should parse here the Notwell permissions :) */
/*@-unrecog@*/
if (S_ISDIR (st->st_mode))
st->st_mode |= (S_IRUSR | S_IRGRP | S_IROTH | S_IWUSR | S_IXUSR | S_IXGRP | S_IXOTH);
else
st->st_mode |= (S_IRUSR | S_IRGRP | S_IROTH | S_IWUSR);
p += 9;
/*@=unrecog@*/
} else {
if ((i = vfs_parse_filemode(p)) == -1)
goto error;
@ -591,7 +600,7 @@ vfs_parse_ls_lga (char *p, struct stat *st, char **filename, char **linkname)
#ifdef HACK
st->st_uid = finduid (columns [1]);
#else
unameToUid (columns [1], &st->st_uid);
(void) unameToUid (columns [1], &st->st_uid);
#endif
else
st->st_uid = (uid_t) atol (columns [1]);
@ -615,7 +624,7 @@ vfs_parse_ls_lga (char *p, struct stat *st, char **filename, char **linkname)
#ifdef HACK
st->st_gid = findgid (columns [2]);
#else
gnameToGid (columns [1], &st->st_gid);
(void) gnameToGid (columns [1], &st->st_gid);
#endif
idx2 = 3;
}
@ -731,7 +740,9 @@ error:
}
#endif
/*@-usereleased@*/
if (p_copy != p) /* Carefull! */
/*@=usereleased@*/
g_free (p_copy);
return 0;
}
@ -749,7 +760,7 @@ static /*@only@*/ char * ftpBuf = NULL;
#define alloca_strdup(_s) strcpy(alloca(strlen(_s)+1), (_s))
static int ftpNLST(const char * url, ftpSysCall_t ftpSysCall,
struct stat * st, char * rlbuf, size_t rlbufsiz)
/*@out@*/ struct stat * st, char * rlbuf, size_t rlbufsiz)
{
FD_t fd;
const char * path;
@ -916,16 +927,16 @@ static int ftpNLST(const char * url, ftpSysCall_t ftpSysCall,
}
exit:
ufdClose(fd);
(void) ufdClose(fd);
return rc;
}
static int ftpStat(const char * path, struct stat *st)
static int ftpStat(const char * path, /*@out@*/ struct stat *st)
{
return ftpNLST(path, DO_FTP_STAT, st, NULL, 0);
}
static int ftpLstat(const char * path, struct stat *st) {
static int ftpLstat(const char * path, /*@out@*/ struct stat *st) {
int rc;
rc = ftpNLST(path, DO_FTP_LSTAT, st, NULL, 0);
if (_rpmio_debug)
@ -938,15 +949,18 @@ static int ftpReadlink(const char * path, char * buf, size_t bufsiz) {
}
static int ftpGlob(const char * path, int flags,
int errfunc(const char * epath, int eerno), glob_t * pglob)
int errfunc(const char * epath, int eerno),
/*@out@*/ glob_t * pglob)
{
int rc;
if (pglob == NULL)
return -2;
rc = ftpNLST(path, DO_FTP_GLOB, NULL, NULL, 0);
/*@-castfcnptr@*/
if (_rpmio_debug)
fprintf(stderr, "*** ftpGlob(%s,0x%x,%p,%p) ftpNLST rc %d\n", path, (unsigned)flags, errfunc, pglob, rc);
fprintf(stderr, "*** ftpGlob(%s,0x%x,%p,%p) ftpNLST rc %d\n", path, (unsigned)flags, (void *)errfunc, pglob, rc);
/*@=castfcnptr@*/
if (rc)
return rc;
rc = poptParseArgvString(ftpBuf, &pglob->gl_pathc, (const char ***)&pglob->gl_pathv);
@ -957,8 +971,10 @@ fprintf(stderr, "*** ftpGlob(%s,0x%x,%p,%p) ftpNLST rc %d\n", path, (unsigned)fl
static void ftpGlobfree(glob_t * pglob) {
if (_rpmio_debug)
fprintf(stderr, "*** ftpGlobfree(%p)\n", pglob);
if (pglob->gl_offs == -1) /* XXX HACK HACK HACK */
if (pglob->gl_offs == -1) { /* XXX HACK HACK HACK */
free((void *)pglob->gl_pathv);
pglob->gl_pathv = NULL;
}
}
int Stat(const char * path, struct stat * st) {
@ -1059,8 +1075,10 @@ int Glob(const char *path, int flags,
const char * lpath;
int ut = urlPath(path, &lpath);
/*@-castfcnptr@*/
if (_rpmio_debug)
fprintf(stderr, "*** Glob(%s,0x%x,%p,%p)\n", path, (unsigned)flags, errfunc, pglob);
fprintf(stderr, "*** Glob(%s,0x%x,%p,%p)\n", path, (unsigned)flags, (void *)errfunc, pglob);
/*@=castfcnptr@*/
switch (ut) {
case URL_IS_FTP: /* XXX WRONG WRONG WRONG */
return ftpGlob(path, flags, errfunc, pglob);
@ -1112,16 +1130,18 @@ fprintf(stderr, "*** Opendir(%s)\n", path);
return opendir(path);
}
/*@+voidabstract@*/
struct dirent * Readdir(DIR * dir)
{
if (_rpmio_debug)
fprintf(stderr, "*** Readdir(%p)\n", dir);
fprintf(stderr, "*** Readdir(%p)\n", (void *)dir);
return readdir(dir);
}
int Closedir(DIR * dir)
{
if (_rpmio_debug)
fprintf(stderr, "*** Closedir(%p)\n", dir);
fprintf(stderr, "*** Closedir(%p)\n", (void *)dir);
return closedir(dir);
}
/*@=voidabstract@*/

View File

@ -78,11 +78,11 @@ URLDBGREFS(0, (stderr, "--> url %p -- %d %s at %s:%u\n", u, u->nrefs, msg, file,
void * fp = fdGetFp(u->ctrl);
if (fp) {
fdPush(u->ctrl, fpio, fp, -1); /* Push fpio onto stack */
Fclose(u->ctrl);
(void) Fclose(u->ctrl);
} else if (fdio->_fileno(u->ctrl) >= 0)
fdio->close(u->ctrl);
#else
Fclose(u->ctrl);
(void) Fclose(u->ctrl);
#endif
u->ctrl = fdio->_fdderef(u->ctrl, "persist ctrl (urlFree)", file, line);
@ -97,11 +97,11 @@ URLDBGREFS(0, (stderr, "--> url %p -- %d %s at %s:%u\n", u, u->nrefs, msg, file,
void * fp = fdGetFp(u->data);
if (fp) {
fdPush(u->data, fpio, fp, -1); /* Push fpio onto stack */
Fclose(u->data);
(void) Fclose(u->data);
} else if (fdio->_fileno(u->data) >= 0)
fdio->close(u->data);
#else
Fclose(u->ctrl);
(void) Fclose(u->ctrl);
#endif
u->data = fdio->_fdderef(u->data, "persist data (urlFree)", file, line);
@ -209,11 +209,16 @@ static void urlFind(urlinfo *uret, int mustAsk)
u = urlLink(uCache[ucx], "uCache");
*uret = u;
/*@-usereleased@*/
u = urlFree(u, "uCache (urlFind)");
/*@=usereleased@*/
/* Zap proxy host and port in case they have been reset */
u->proxyp = -1;
if (u->proxyh) free((void *)u->proxyh);
if (u->proxyh) {
free((void *)u->proxyh);
u->proxyh = NULL;
}
/* Perform one-time FTP initialization */
if (u->urltype == URL_IS_FTP) {
@ -478,9 +483,9 @@ fprintf(stderr, "*** urlGetFile sfd %p %s tfd %p %s\n", sfd, url, tfd, dest);
case URL_IS_DASH:
case URL_IS_UNKNOWN:
if ((rc = ufdGetFile(sfd, tfd))) {
Unlink(dest);
(void) Unlink(dest);
/* XXX FIXME: sfd possibly closed by copyData */
/*@-usereleased@*/ Fclose(sfd) /*@=usereleased@*/ ;
/*@-usereleased@*/ (void) Fclose(sfd) /*@=usereleased@*/ ;
}
sfd = NULL; /* XXX Fclose(sfd) done by ufdGetFile */
break;
@ -491,9 +496,9 @@ fprintf(stderr, "*** urlGetFile sfd %p %s tfd %p %s\n", sfd, url, tfd, dest);
exit:
if (tfd)
Fclose(tfd);
(void) Fclose(tfd);
if (sfd)
Fclose(sfd);
(void) Fclose(sfd);
return rc;
}

View File

@ -1557,7 +1557,9 @@ int main(int argc, const char ** argv)
}
#if defined(IAM_RPMBT) || defined(IAM_RPMK)
exit:
#endif /* IAM_RPMBT || IAM_RPMK */
poptFreeContext(optCon);
rpmFreeMacros(NULL);
rpmFreeMacros(&rpmCLIMacroContext);