int parseFiles(rpmSpec spec)
{
- int nextPart;
+ int nextPart, res = PART_ERROR;
Package pkg;
int rc, argc;
int arg;
if ((rc = poptParseArgvString(spec->line, &argc, &argv))) {
rpmlog(RPMLOG_ERR, _("line %d: Error parsing %%files: %s\n"),
spec->lineNum, poptStrerror(rc));
- rc = RPMRC_FAIL;
goto exit;
}
spec->lineNum,
poptBadOption(optCon, POPT_BADOPTION_NOALIAS),
spec->line);
- rc = RPMRC_FAIL;
goto exit;
}
rpmlog(RPMLOG_ERR, _("line %d: Too many names: %s\n"),
spec->lineNum,
spec->line);
- rc = RPMRC_FAIL;
goto exit;
}
}
if (lookupPackage(spec, name, flag, &pkg)) {
rpmlog(RPMLOG_ERR, _("line %d: Package does not exist: %s\n"),
spec->lineNum, spec->line);
- rc = RPMRC_FAIL;
goto exit;
}
if (pkg->fileList != NULL) {
rpmlog(RPMLOG_ERR, _("line %d: Second %%files list\n"),
spec->lineNum);
- rc = RPMRC_FAIL;
goto exit;
}
if ((rc = readLine(spec, STRIP_COMMENTS)) > 0) {
nextPart = PART_NONE;
+ } else if (rc < 0) {
+ goto exit;
} else {
- if (rc)
- goto exit;
while (! (nextPart = isPart(spec->line))) {
appendStringBuf(pkg->fileList, spec->line);
if ((rc = readLine(spec, STRIP_COMMENTS)) > 0) {
nextPart = PART_NONE;
break;
- }
- if (rc)
+ } else if (rc < 0) {
goto exit;
+ }
}
}
- rc = nextPart;
+ res = nextPart;
exit:
argv = _free(argv);
optCon = poptFreeContext(optCon);
- return rc;
+ return res;
}