diff options
author | jbj <devnull@localhost> | 1998-11-16 21:40:28 +0000 |
---|---|---|
committer | jbj <devnull@localhost> | 1998-11-16 21:40:28 +0000 |
commit | 28c4ae83a312a54cbe0faa2827ca6a3f9106b4a9 (patch) | |
tree | b73dd13f60ab5e3904f93cd76622c4f5f61ad6f1 /build | |
parent | bed2bf89c9cc52f655900413d32eb8a5bdcb810c (diff) | |
download | rpm-28c4ae83a312a54cbe0faa2827ca6a3f9106b4a9.tar.gz rpm-28c4ae83a312a54cbe0faa2827ca6a3f9106b4a9.tar.bz2 rpm-28c4ae83a312a54cbe0faa2827ca6a3f9106b4a9.zip |
LCLINT pass 0.
CVS patchset: 2540
CVS date: 1998/11/16 21:40:28
Diffstat (limited to 'build')
-rw-r--r-- | build/.files | 18 | ||||
-rw-r--r-- | build/.lclintrc | 36 | ||||
-rw-r--r-- | build/build.c | 4 | ||||
-rw-r--r-- | build/files.c | 20 | ||||
-rw-r--r-- | build/myftw.c | 1 | ||||
-rw-r--r-- | build/pack.c | 15 | ||||
-rw-r--r-- | build/parseBuildInstallClean.c | 2 | ||||
-rw-r--r-- | build/parseFiles.c | 2 | ||||
-rw-r--r-- | build/parsePreamble.c | 2 | ||||
-rw-r--r-- | build/parsePrep.c | 18 | ||||
-rw-r--r-- | build/parseSpec.c | 6 | ||||
-rw-r--r-- | build/spec.c | 2 |
12 files changed, 100 insertions, 26 deletions
diff --git a/build/.files b/build/.files new file mode 100644 index 000000000..e888cd303 --- /dev/null +++ b/build/.files @@ -0,0 +1,18 @@ +build.c +expression.c +files.c +misc.c +myftw.c +names.c +pack.c +parseBuildInstallClean.c +parseChangelog.c +parseDescription.c +parseFiles.c +parsePreamble.c +parsePrep.c +parseReqs.c +parseScript.c +parseSpec.c +reqprov.c +spec.c diff --git a/build/.lclintrc b/build/.lclintrc new file mode 100644 index 000000000..7e763e22f --- /dev/null +++ b/build/.lclintrc @@ -0,0 +1,36 @@ +-I. -I.. -I../lib + +-Du_long=unsigned +-Du_int=unsigned +-Du_short=short +-Du_char=char + +-Du_int32_t=unsigned +-Du_int16_t=short + +-Dfd_set=void + ++partial + ++unixlib #-> +posixlib +-warnunixlib + ++boolint +-boolops +-fixedformalarray +-formattype +-fullinitblock ++ignorequals ++ignoresigns ++longintegral ++matchanyintegral +-mustfree +-nullpass +-observertrans +-predboolint +-predboolothers +-redef +-retvalint +-retvalother +-shiftsigned +-type diff --git a/build/build.c b/build/build.c index 6dc6fbc7b..d6d3d3a62 100644 --- a/build/build.c +++ b/build/build.c @@ -79,7 +79,7 @@ int doScript(Spec spec, int what, char *name, StringBuf sb, int test) case RPMBUILD_STRINGBUF: break; } - if ((what != RPMBUILD_RMBUILD) && !sb) { + if ((what != RPMBUILD_RMBUILD) && sb == NULL) { return 0; } @@ -133,7 +133,7 @@ int doScript(Spec spec, int what, char *name, StringBuf sb, int test) FREE(scriptName); return RPMERR_SCRIPT; } - wait(&status); + (void)wait(&status); if (! WIFEXITED(status) || WEXITSTATUS(status)) { rpmError(RPMERR_SCRIPT, _("Bad exit status from %s (%s)"), scriptName, name); diff --git a/build/files.c b/build/files.c index fcd86bcc2..736464b02 100644 --- a/build/files.c +++ b/build/files.c @@ -10,6 +10,12 @@ #include "md5.h" #include "rpmmacro.h" +#ifdef __LCLINT__ +#define FINDPROVIDES "/usr/lib/rpm/find-provides" +#define FINDREQUIRES "/usr/lib/rpm/find-requires" +#define MKDIR_P "mkdir -p" +#endif + #define MAXDOCDIR 1024 struct FileListRec { @@ -362,7 +368,7 @@ static int parseForAttr(char *buf, struct FileList *fl) if (!strcmp(resultAttr->PmodeString, "-")) { resultAttr->PmodeString = NULL; } else { - x = sscanf(resultAttr->PmodeString, "%o", &(resultAttr->Pmode)); + x = sscanf(resultAttr->PmodeString, "%o", (unsigned *)&(resultAttr->Pmode)); if ((x == 0) || (resultAttr->Pmode >> 12)) { rpmError(RPMERR_BADSPEC, _("Bad %s() mode spec: %s"), name, buf); resultAttr->PmodeString = resultAttr->Uname = @@ -379,7 +385,7 @@ static int parseForAttr(char *buf, struct FileList *fl) resultAttr->PdirmodeString = strdup(resultAttr->PdirmodeString); } else { x = sscanf(resultAttr->PdirmodeString, "%o", - &(resultAttr->Pdirmode)); + (unsigned *)&(resultAttr->Pdirmode)); if ((x == 0) || (resultAttr->Pdirmode >> 12)) { rpmError(RPMERR_BADSPEC, _("Bad %s() dirmode spec: %s"), name, buf); @@ -1511,10 +1517,10 @@ static StringBuf getOutputFrom(char *dir, char *argv[], if (toProg[1] >= 0) close(toProg[1]); close(fromProg[0]); - signal(SIGPIPE, oldhandler); + (void)signal(SIGPIPE, oldhandler); /* Collect status from prog */ - waitpid(progPID, &status, 0); + (void)waitpid(progPID, &status, 0); if (failNonZero && (!WIFEXITED(status) || WEXITSTATUS(status))) { rpmError(RPMERR_EXEC, _("%s failed"), argv[0]); return NULL; @@ -1560,7 +1566,7 @@ static int generateAutoReqProv(Spec spec, Package pkg, argv[1] = NULL; readBuf = getOutputFrom(NULL, argv, getStringBuf(writeBuf), writeBytes, 1); - if (!readBuf) { + if (readBuf == NULL) { rpmError(RPMERR_EXEC, _("Failed to find provides")); freeStringBuf(writeBuf); return RPMERR_EXEC; @@ -1587,7 +1593,7 @@ static int generateAutoReqProv(Spec spec, Package pkg, argv[1] = NULL; readBuf = getOutputFrom(NULL, argv, getStringBuf(writeBuf), writeBytes, 0); - if (!readBuf) { + if (readBuf == NULL) { rpmError(RPMERR_EXEC, _("Failed to find requires")); freeStringBuf(writeBuf); return RPMERR_EXEC; @@ -1675,7 +1681,7 @@ int processBinaryFiles(Spec spec, int installSpecialDoc, int test) res = 0; for (pkg = spec->packages; pkg != NULL; pkg = pkg->next) { - if (!pkg->fileList) { + if (pkg->fileList == NULL) { continue; } diff --git a/build/myftw.c b/build/myftw.c index 16656554f..21cba4663 100644 --- a/build/myftw.c +++ b/build/myftw.c @@ -176,6 +176,7 @@ int myftw (const char *dir, if (descriptors <= 0) descriptors = 1; + /*@access DIR@*/ dirs = (DIR **) alloca (descriptors * sizeof (DIR *)); i = descriptors; while (i-- > 0) diff --git a/build/pack.c b/build/pack.c index ebdfe363c..b7f5a5f01 100644 --- a/build/pack.c +++ b/build/pack.c @@ -48,6 +48,9 @@ int packageSources(Spec spec) int_32 tag, count; char **ptr; +#ifdef __LCLINT__ +#define VERSION "3.0" +#endif /* Add some cruft */ headerAddEntry(spec->sourceHeader, RPMTAG_RPMVERSION, RPM_STRING_TYPE, VERSION, 1); @@ -106,7 +109,7 @@ int packageBinaries(Spec spec) for (pkg = spec->packages; pkg != NULL; pkg = pkg->next) { - if (!pkg->fileList) + if (pkg->fileList == NULL) continue; if ((rc = processScriptFiles(spec, pkg))) @@ -181,14 +184,14 @@ int readRPM(char *fileName, Spec *specp, struct rpmlead *lead, Header *sigs, strerror(errno)); return RPMERR_BADMAGIC; } - lseek(fdi, 0, SEEK_SET); /* XXX FIXME: EPIPE */ + (void)lseek(fdi, 0, SEEK_SET); /* XXX FIXME: EPIPE */ /* Reallocate build data structures */ spec = newSpec(); spec->packages = newPackage(spec); /* XXX the header just allocated will be allocated again */ - if (spec->packages->header) { + if (spec->packages->header != NULL) { headerFree(spec->packages->header); spec->packages->header = NULL; } @@ -272,7 +275,7 @@ int writeRPM(Header header, char *fileName, int type, headerModifyEntry(header, RPMTAG_ARCHIVESIZE, RPM_INT32_TYPE, &csa->cpioArchiveSize, 1); } - lseek(fd, 0, SEEK_SET); + (void)lseek(fd, 0, SEEK_SET); headerWrite(fd, header, HEADER_MAGIC_YES); close(fd); @@ -456,7 +459,7 @@ static int addFileToTag(Spec spec, char *file, Header h, int tag) headerRemoveEntry(h, tag); } - if (! (sb = addFileToTagAux(spec, file, sb))) { + if ((sb = addFileToTagAux(spec, file, sb)) == NULL) { return 1; } @@ -472,7 +475,7 @@ static int addFileToArrayTag(Spec spec, char *file, Header h, int tag) char *s; sb = newStringBuf(); - if (! (sb = addFileToTagAux(spec, file, sb))) { + if ((sb = addFileToTagAux(spec, file, sb)) == NULL) { return 1; } diff --git a/build/parseBuildInstallClean.c b/build/parseBuildInstallClean.c index 8ba908e14..2b181bede 100644 --- a/build/parseBuildInstallClean.c +++ b/build/parseBuildInstallClean.c @@ -23,7 +23,7 @@ int parseBuildInstallClean(Spec spec, int parsePart) break; } - if (*sbp) { + if (*sbp != NULL) { rpmError(RPMERR_BADSPEC, _("line %d: second %s"), spec->lineNum, name); return RPMERR_BADSPEC; } diff --git a/build/parseFiles.c b/build/parseFiles.c index ecfbb9d85..fcbe6eb9e 100644 --- a/build/parseFiles.c +++ b/build/parseFiles.c @@ -70,7 +70,7 @@ int parseFiles(Spec spec) return RPMERR_BADSPEC; } - if (pkg->fileList) { + if (pkg->fileList != NULL) { rpmError(RPMERR_BADSPEC, _("line %d: Second %%files list"), spec->lineNum); FREE(argv); diff --git a/build/parsePreamble.c b/build/parsePreamble.c index 4df1c363c..e1077c4fc 100644 --- a/build/parsePreamble.c +++ b/build/parsePreamble.c @@ -72,7 +72,7 @@ static int parseSimplePart(char *line, char **name, int *flag) strcpy(linebuf, line); /* Throw away the first token (the %xxxx) */ - strtok(linebuf, " \t\n"); + (void)strtok(linebuf, " \t\n"); if (!(tok = strtok(NULL, " \t\n"))) { *name = NULL; diff --git a/build/parsePrep.c b/build/parsePrep.c index 620ae9d97..b252971ca 100644 --- a/build/parsePrep.c +++ b/build/parsePrep.c @@ -19,6 +19,10 @@ { 0, 0, 0, 0, 0 } }; +#ifdef __LCLINT__ +#define MKDIR_P "mkdir -p" +#endif + #ifdef DYING static int doSetupMacro(Spec spec, char *line); static int doPatchMacro(Spec spec, char *line); @@ -286,6 +290,9 @@ static int doSetupMacro(Spec spec, char *line) /* clean up permissions etc */ if (!geteuid()) { appendLineStringBuf(spec->prep, "chown -R root ."); +#ifdef __LCLINT__ +#define ROOT_GROUP "root" +#endif appendLineStringBuf(spec->prep, "chgrp -R " ROOT_GROUP " ."); } @@ -303,7 +310,7 @@ static int doPatchMacro(Spec spec, char *line) char *opt_b; int opt_P, opt_p, opt_R, opt_E; char *s; - char buf[BUFSIZ]; + char buf[BUFSIZ], *bp; int patch_nums[1024]; /* XXX - we can only handle 1024 patches! */ int patch_index, x; @@ -318,8 +325,11 @@ static int doPatchMacro(Spec spec, char *line) strcpy(buf, line); } - strtok(buf, " \t\n"); /* remove %patch */ - while ((s = strtok(NULL, " \t\n"))) { + for (bp = buf; (s = strtok(bp, " \t\n")) != NULL;) { + if (bp) { /* remove 1st token (%patch) */ + bp = NULL; + continue; + } if (!strcmp(s, "-P")) { opt_P = 1; } else if (!strcmp(s, "-R")) { @@ -402,7 +412,7 @@ int parsePrep(Spec spec, int force) StringBuf buf; char **lines, **saveLines; - if (spec->prep) { + if (spec->prep != NULL) { rpmError(RPMERR_BADSPEC, _("line %d: second %%prep"), spec->lineNum); return RPMERR_BADSPEC; } diff --git a/build/parseSpec.c b/build/parseSpec.c index e82604079..5aeb5a955 100644 --- a/build/parseSpec.c +++ b/build/parseSpec.c @@ -69,7 +69,7 @@ static int matchTok(char *token, char *line); static int matchTok(char *token, char *line) { - char buf[BUFSIZ], *tok; + char buf[BUFSIZ], *bp, *tok; /* * XXX The strcasecmp below is necessary so the old (rpm < 2.90) style @@ -77,8 +77,8 @@ static int matchTok(char *token, char *line) * XXX os-from-platform (e.g "linux" from "sparc-*-linux"). */ strcpy(buf, line); - strtok(buf, " \n\t"); - while ((tok = strtok(NULL, " \n\t"))) { + for (bp = buf; (tok = strtok(bp, " \n\t")) != NULL;) { + bp = NULL; if (! strcasecmp(tok, token)) { return 1; } diff --git a/build/spec.c b/build/spec.c index 57e86e107..41aa69b59 100644 --- a/build/spec.c +++ b/build/spec.c @@ -419,7 +419,7 @@ void freeSpec(Spec spec) free(rl); } - if (spec->sourceHeader) { + if (spec->sourceHeader != NULL) { headerFree(spec->sourceHeader); } |