Replace all rpmError() uses with rpmlog()

This commit is contained in:
Panu Matilainen 2007-10-09 14:06:06 +03:00
parent 46921b2334
commit d709195c3a
38 changed files with 389 additions and 389 deletions

20
build.c
View File

@ -60,7 +60,7 @@ static int isSpecFile(const char * specfile)
fd = Fopen(specfile, "r.ufdio"); fd = Fopen(specfile, "r.ufdio");
if (fd == NULL || Ferror(fd)) { if (fd == NULL || Ferror(fd)) {
rpmError(RPMERR_OPEN, _("Unable to open spec file %s: %s\n"), rpmlog(RPMERR_OPEN, _("Unable to open spec file %s: %s\n"),
specfile, Fstrerror(fd)); specfile, Fstrerror(fd));
return 0; return 0;
} }
@ -137,7 +137,7 @@ static int buildForTarget(rpmts ts, const char * arg, BTA_t ba)
sprintf(cmd, "%s < '%s' | tar xOvf - Specfile 2>&1 > '%s'", sprintf(cmd, "%s < '%s' | tar xOvf - Specfile 2>&1 > '%s'",
zcmds[res & 0x3], arg, tmpSpecFile); zcmds[res & 0x3], arg, tmpSpecFile);
if (!(fp = popen(cmd, "r"))) { if (!(fp = popen(cmd, "r"))) {
rpmError(RPMERR_POPEN, _("Failed to open tar pipe: %m\n")); rpmlog(RPMERR_POPEN, _("Failed to open tar pipe: %m\n"));
specDir = _free(specDir); specDir = _free(specDir);
tmpSpecFile = _free(tmpSpecFile); tmpSpecFile = _free(tmpSpecFile);
return 1; return 1;
@ -149,14 +149,14 @@ static int buildForTarget(rpmts ts, const char * arg, BTA_t ba)
sprintf(cmd, "%s < '%s' | tar xOvf - --wildcards \\*.spec 2>&1 > '%s'", sprintf(cmd, "%s < '%s' | tar xOvf - --wildcards \\*.spec 2>&1 > '%s'",
zcmds[res & 0x3], arg, tmpSpecFile); zcmds[res & 0x3], arg, tmpSpecFile);
if (!(fp = popen(cmd, "r"))) { if (!(fp = popen(cmd, "r"))) {
rpmError(RPMERR_POPEN, _("Failed to open tar pipe: %m\n")); rpmlog(RPMERR_POPEN, _("Failed to open tar pipe: %m\n"));
specDir = _free(specDir); specDir = _free(specDir);
tmpSpecFile = _free(tmpSpecFile); tmpSpecFile = _free(tmpSpecFile);
return 1; return 1;
} }
if (!fgets(buf, sizeof(buf) - 1, fp)) { if (!fgets(buf, sizeof(buf) - 1, fp)) {
/* Give up */ /* Give up */
rpmError(RPMERR_READ, _("Failed to read spec file from %s\n"), rpmlog(RPMERR_READ, _("Failed to read spec file from %s\n"),
arg); arg);
(void) unlink(tmpSpecFile); (void) unlink(tmpSpecFile);
specDir = _free(specDir); specDir = _free(specDir);
@ -184,7 +184,7 @@ static int buildForTarget(rpmts ts, const char * arg, BTA_t ba)
specDir = _free(specDir); specDir = _free(specDir);
if (res) { if (res) {
rpmError(RPMERR_RENAME, _("Failed to rename %s to %s: %m\n"), rpmlog(RPMERR_RENAME, _("Failed to rename %s to %s: %m\n"),
tmpSpecFile, s); tmpSpecFile, s);
(void) unlink(tmpSpecFile); (void) unlink(tmpSpecFile);
tmpSpecFile = _free(tmpSpecFile); tmpSpecFile = _free(tmpSpecFile);
@ -197,7 +197,7 @@ static int buildForTarget(rpmts ts, const char * arg, BTA_t ba)
if (*arg != '/') { if (*arg != '/') {
if (!getcwd(buf, BUFSIZ)) { if (!getcwd(buf, BUFSIZ)) {
rpmError(RPMERR_STAT, "getcwd failed: %m\n"); rpmlog(RPMERR_STAT, "getcwd failed: %m\n");
return 1; return 1;
} }
strcat(buf, "/"); strcat(buf, "/");
@ -218,7 +218,7 @@ static int buildForTarget(rpmts ts, const char * arg, BTA_t ba)
if (*specFile != '/') { if (*specFile != '/') {
char *s = alloca(BUFSIZ); char *s = alloca(BUFSIZ);
if (!getcwd(s, BUFSIZ)) { if (!getcwd(s, BUFSIZ)) {
rpmError(RPMERR_STAT, "getcwd failed: %m\n"); rpmlog(RPMERR_STAT, "getcwd failed: %m\n");
rc = 1; rc = 1;
goto exit; goto exit;
} }
@ -230,12 +230,12 @@ static int buildForTarget(rpmts ts, const char * arg, BTA_t ba)
if (specut != URL_IS_DASH) { if (specut != URL_IS_DASH) {
struct stat st; struct stat st;
if (Stat(specURL, &st) < 0) { if (Stat(specURL, &st) < 0) {
rpmError(RPMERR_STAT, _("failed to stat %s: %m\n"), specURL); rpmlog(RPMERR_STAT, _("failed to stat %s: %m\n"), specURL);
rc = 1; rc = 1;
goto exit; goto exit;
} }
if (! S_ISREG(st.st_mode)) { if (! S_ISREG(st.st_mode)) {
rpmError(RPMERR_NOTREG, _("File %s is not a regular file.\n"), rpmlog(RPMERR_NOTREG, _("File %s is not a regular file.\n"),
specURL); specURL);
rc = 1; rc = 1;
goto exit; goto exit;
@ -243,7 +243,7 @@ static int buildForTarget(rpmts ts, const char * arg, BTA_t ba)
/* Try to verify that the file is actually a specfile */ /* Try to verify that the file is actually a specfile */
if (!isSpecFile(specURL)) { if (!isSpecFile(specURL)) {
rpmError(RPMERR_BADSPEC, rpmlog(RPMERR_BADSPEC,
_("File %s does not appear to be a specfile.\n"), specURL); _("File %s does not appear to be a specfile.\n"), specURL);
rc = 1; rc = 1;
goto exit; goto exit;

View File

@ -129,7 +129,7 @@ int doScript(rpmSpec spec, int what, const char *name, StringBuf sb, int test)
} }
if (makeTempFile(rootURL, &scriptName, &fd) || fd == NULL || Ferror(fd)) { if (makeTempFile(rootURL, &scriptName, &fd) || fd == NULL || Ferror(fd)) {
rpmError(RPMERR_SCRIPT, _("Unable to open temp file.\n")); rpmlog(RPMERR_SCRIPT, _("Unable to open temp file.\n"));
rc = RPMERR_SCRIPT; rc = RPMERR_SCRIPT;
goto exit; goto exit;
} }
@ -221,7 +221,7 @@ fprintf(stderr, "*** addMacros\n");
errno = 0; errno = 0;
(void) execvp(argv[0], (char *const *)argv); (void) execvp(argv[0], (char *const *)argv);
rpmError(RPMERR_SCRIPT, _("Exec of %s failed (%s): %s\n"), rpmlog(RPMERR_SCRIPT, _("Exec of %s failed (%s): %s\n"),
scriptName, name, strerror(errno)); scriptName, name, strerror(errno));
_exit(-1); _exit(-1);
@ -230,7 +230,7 @@ fprintf(stderr, "*** addMacros\n");
rc = waitpid(child, &status, 0); rc = waitpid(child, &status, 0);
if (!WIFEXITED(status) || WEXITSTATUS(status)) { if (!WIFEXITED(status) || WEXITSTATUS(status)) {
rpmError(RPMERR_SCRIPT, _("Bad exit status from %s (%s)\n"), rpmlog(RPMERR_SCRIPT, _("Bad exit status from %s (%s)\n"),
scriptName, name); scriptName, name);
rc = RPMERR_SCRIPT; rc = RPMERR_SCRIPT;
} else } else

View File

@ -211,7 +211,7 @@ static int rdToken(ParseState state)
token = TOK_EQ; token = TOK_EQ;
p++; p++;
} else { } else {
rpmError(RPMERR_BADSPEC, _("syntax error while parsing ==\n")); rpmlog(RPMERR_BADSPEC, _("syntax error while parsing ==\n"));
return -1; return -1;
} }
break; break;
@ -241,7 +241,7 @@ static int rdToken(ParseState state)
token = TOK_LOGICAL_AND; token = TOK_LOGICAL_AND;
p++; p++;
} else { } else {
rpmError(RPMERR_BADSPEC, _("syntax error while parsing &&\n")); rpmlog(RPMERR_BADSPEC, _("syntax error while parsing &&\n"));
return -1; return -1;
} }
break; break;
@ -250,7 +250,7 @@ static int rdToken(ParseState state)
token = TOK_LOGICAL_OR; token = TOK_LOGICAL_OR;
p++; p++;
} else { } else {
rpmError(RPMERR_BADSPEC, _("syntax error while parsing ||\n")); rpmlog(RPMERR_BADSPEC, _("syntax error while parsing ||\n"));
return -1; return -1;
} }
break; break;
@ -293,7 +293,7 @@ static int rdToken(ParseState state)
v = valueMakeString( rpmExpand(temp, NULL) ); v = valueMakeString( rpmExpand(temp, NULL) );
} else { } else {
rpmError(RPMERR_BADSPEC, _("parse error in expression\n")); rpmlog(RPMERR_BADSPEC, _("parse error in expression\n"));
return -1; return -1;
} }
} }
@ -325,7 +325,7 @@ static Value doPrimary(ParseState state)
return NULL; return NULL;
v = doLogical(state); v = doLogical(state);
if (state->nextToken != TOK_CLOSE_P) { if (state->nextToken != TOK_CLOSE_P) {
rpmError(RPMERR_BADSPEC, _("unmatched (\n")); rpmlog(RPMERR_BADSPEC, _("unmatched (\n"));
return NULL; return NULL;
} }
if (rdToken(state)) if (rdToken(state))
@ -357,7 +357,7 @@ static Value doPrimary(ParseState state)
return NULL; return NULL;
if (! valueIsInteger(v)) { if (! valueIsInteger(v)) {
rpmError(RPMERR_BADSPEC, _("- only on numbers\n")); rpmlog(RPMERR_BADSPEC, _("- only on numbers\n"));
return NULL; return NULL;
} }
@ -373,7 +373,7 @@ static Value doPrimary(ParseState state)
return NULL; return NULL;
if (! valueIsInteger(v)) { if (! valueIsInteger(v)) {
rpmError(RPMERR_BADSPEC, _("! only on numbers\n")); rpmlog(RPMERR_BADSPEC, _("! only on numbers\n"));
return NULL; return NULL;
} }
@ -415,7 +415,7 @@ static Value doMultiplyDivide(ParseState state)
return NULL; return NULL;
if (! valueSameType(v1, v2)) { if (! valueSameType(v1, v2)) {
rpmError(RPMERR_BADSPEC, _("types must match\n")); rpmlog(RPMERR_BADSPEC, _("types must match\n"));
return NULL; return NULL;
} }
@ -428,7 +428,7 @@ static Value doMultiplyDivide(ParseState state)
else else
v1 = valueMakeInteger(i1 / i2); v1 = valueMakeInteger(i1 / i2);
} else { } else {
rpmError(RPMERR_BADSPEC, _("* / not suported for strings\n")); rpmlog(RPMERR_BADSPEC, _("* / not suported for strings\n"));
return NULL; return NULL;
} }
} }
@ -463,7 +463,7 @@ static Value doAddSubtract(ParseState state)
return NULL; return NULL;
if (! valueSameType(v1, v2)) { if (! valueSameType(v1, v2)) {
rpmError(RPMERR_BADSPEC, _("types must match\n")); rpmlog(RPMERR_BADSPEC, _("types must match\n"));
return NULL; return NULL;
} }
@ -479,7 +479,7 @@ static Value doAddSubtract(ParseState state)
char *copy; char *copy;
if (op == TOK_MINUS) { if (op == TOK_MINUS) {
rpmError(RPMERR_BADSPEC, _("- not suported for strings\n")); rpmlog(RPMERR_BADSPEC, _("- not suported for strings\n"));
return NULL; return NULL;
} }
@ -521,7 +521,7 @@ static Value doRelational(ParseState state)
return NULL; return NULL;
if (! valueSameType(v1, v2)) { if (! valueSameType(v1, v2)) {
rpmError(RPMERR_BADSPEC, _("types must match\n")); rpmlog(RPMERR_BADSPEC, _("types must match\n"));
return NULL; return NULL;
} }
@ -613,7 +613,7 @@ static Value doLogical(ParseState state)
return NULL; return NULL;
if (! valueSameType(v1, v2)) { if (! valueSameType(v1, v2)) {
rpmError(RPMERR_BADSPEC, _("types must match\n")); rpmlog(RPMERR_BADSPEC, _("types must match\n"));
return NULL; return NULL;
} }
@ -626,7 +626,7 @@ static Value doLogical(ParseState state)
else else
v1 = valueMakeInteger(i1 || i2); v1 = valueMakeInteger(i1 || i2);
} else { } else {
rpmError(RPMERR_BADSPEC, _("&& and || not suported for strings\n")); rpmlog(RPMERR_BADSPEC, _("&& and || not suported for strings\n"));
return NULL; return NULL;
} }
} }
@ -659,7 +659,7 @@ int parseExpressionBoolean(rpmSpec spec, const char *expr)
/* If the next token is not TOK_EOF, we have a syntax error. */ /* If the next token is not TOK_EOF, we have a syntax error. */
if (state.nextToken != TOK_EOF) { if (state.nextToken != TOK_EOF) {
rpmError(RPMERR_BADSPEC, _("syntax error in expression\n")); rpmlog(RPMERR_BADSPEC, _("syntax error in expression\n"));
state.str = _free(state.str); state.str = _free(state.str);
return -1; return -1;
} }
@ -706,7 +706,7 @@ char * parseExpressionString(rpmSpec spec, const char *expr)
/* If the next token is not TOK_EOF, we have a syntax error. */ /* If the next token is not TOK_EOF, we have a syntax error. */
if (state.nextToken != TOK_EOF) { if (state.nextToken != TOK_EOF) {
rpmError(RPMERR_BADSPEC, _("syntax error in expression\n")); rpmlog(RPMERR_BADSPEC, _("syntax error in expression\n"));
state.str = _free(state.str); state.str = _free(state.str);
return NULL; return NULL;
} }

View File

@ -305,7 +305,7 @@ static int parseForVerify(char * buf, FileList fl)
SKIPSPACE(pe); SKIPSPACE(pe);
if (*pe != '(') { if (*pe != '(') {
rpmError(RPMERR_BADSPEC, _("Missing '(' in %s %s\n"), name, pe); rpmlog(RPMERR_BADSPEC, _("Missing '(' in %s %s\n"), name, pe);
fl->processingFailed = 1; fl->processingFailed = 1;
return RPMERR_BADSPEC; return RPMERR_BADSPEC;
} }
@ -316,7 +316,7 @@ static int parseForVerify(char * buf, FileList fl)
{}; {};
if (*pe == '\0') { if (*pe == '\0') {
rpmError(RPMERR_BADSPEC, _("Missing ')' in %s(%s\n"), name, p); rpmlog(RPMERR_BADSPEC, _("Missing ')' in %s(%s\n"), name, p);
fl->processingFailed = 1; fl->processingFailed = 1;
return RPMERR_BADSPEC; return RPMERR_BADSPEC;
} }
@ -354,7 +354,7 @@ static int parseForVerify(char * buf, FileList fl)
if (!strcmp(p, "not")) { if (!strcmp(p, "not")) {
negated ^= 1; negated ^= 1;
} else { } else {
rpmError(RPMERR_BADSPEC, _("Invalid %s token: %s\n"), name, p); rpmlog(RPMERR_BADSPEC, _("Invalid %s token: %s\n"), name, p);
fl->processingFailed = 1; fl->processingFailed = 1;
return RPMERR_BADSPEC; return RPMERR_BADSPEC;
} }
@ -458,7 +458,7 @@ static int parseForDev(char * buf, FileList fl)
exit: exit:
if (rc) { if (rc) {
rpmError(RPMERR_BADSPEC, _("Missing %s in %s %s\n"), errstr, name, p); rpmlog(RPMERR_BADSPEC, _("Missing %s in %s %s\n"), errstr, name, p);
fl->processingFailed = 1; fl->processingFailed = 1;
} }
return rc; return rc;
@ -494,7 +494,7 @@ static int parseForAttr(char * buf, FileList fl)
SKIPSPACE(pe); SKIPSPACE(pe);
if (*pe != '(') { if (*pe != '(') {
rpmError(RPMERR_BADSPEC, _("Missing '(' in %s %s\n"), name, pe); rpmlog(RPMERR_BADSPEC, _("Missing '(' in %s %s\n"), name, pe);
fl->processingFailed = 1; fl->processingFailed = 1;
return RPMERR_BADSPEC; return RPMERR_BADSPEC;
} }
@ -509,7 +509,7 @@ static int parseForAttr(char * buf, FileList fl)
q++; q++;
SKIPSPACE(q); SKIPSPACE(q);
if (*q != '\0') { if (*q != '\0') {
rpmError(RPMERR_BADSPEC, rpmlog(RPMERR_BADSPEC,
_("Non-white space follows %s(): %s\n"), name, q); _("Non-white space follows %s(): %s\n"), name, q);
fl->processingFailed = 1; fl->processingFailed = 1;
return RPMERR_BADSPEC; return RPMERR_BADSPEC;
@ -548,7 +548,7 @@ static int parseForAttr(char * buf, FileList fl)
} }
if (!(ar->ar_fmodestr && ar->ar_user && ar->ar_group) || *p != '\0') { if (!(ar->ar_fmodestr && ar->ar_user && ar->ar_group) || *p != '\0') {
rpmError(RPMERR_BADSPEC, _("Bad syntax: %s(%s)\n"), name, q); rpmlog(RPMERR_BADSPEC, _("Bad syntax: %s(%s)\n"), name, q);
fl->processingFailed = 1; fl->processingFailed = 1;
return RPMERR_BADSPEC; return RPMERR_BADSPEC;
} }
@ -558,7 +558,7 @@ static int parseForAttr(char * buf, FileList fl)
unsigned int ui; unsigned int ui;
x = sscanf(ar->ar_fmodestr, "%o", &ui); x = sscanf(ar->ar_fmodestr, "%o", &ui);
if ((x == 0) || (ar->ar_fmode & ~MYALLPERMS)) { if ((x == 0) || (ar->ar_fmode & ~MYALLPERMS)) {
rpmError(RPMERR_BADSPEC, _("Bad mode spec: %s(%s)\n"), name, q); rpmlog(RPMERR_BADSPEC, _("Bad mode spec: %s(%s)\n"), name, q);
fl->processingFailed = 1; fl->processingFailed = 1;
return RPMERR_BADSPEC; return RPMERR_BADSPEC;
} }
@ -570,7 +570,7 @@ static int parseForAttr(char * buf, FileList fl)
unsigned int ui; unsigned int ui;
x = sscanf(ar->ar_dmodestr, "%o", &ui); x = sscanf(ar->ar_dmodestr, "%o", &ui);
if ((x == 0) || (ar->ar_dmode & ~MYALLPERMS)) { if ((x == 0) || (ar->ar_dmode & ~MYALLPERMS)) {
rpmError(RPMERR_BADSPEC, _("Bad dirmode spec: %s(%s)\n"), name, q); rpmlog(RPMERR_BADSPEC, _("Bad dirmode spec: %s(%s)\n"), name, q);
fl->processingFailed = 1; fl->processingFailed = 1;
return RPMERR_BADSPEC; return RPMERR_BADSPEC;
} }
@ -621,7 +621,7 @@ static int parseForConfig(char * buf, FileList fl)
{}; {};
if (*pe == '\0') { if (*pe == '\0') {
rpmError(RPMERR_BADSPEC, _("Missing ')' in %s(%s\n"), name, p); rpmlog(RPMERR_BADSPEC, _("Missing ')' in %s(%s\n"), name, p);
fl->processingFailed = 1; fl->processingFailed = 1;
return RPMERR_BADSPEC; return RPMERR_BADSPEC;
} }
@ -646,7 +646,7 @@ static int parseForConfig(char * buf, FileList fl)
} else if (!strcmp(p, "noreplace")) { } else if (!strcmp(p, "noreplace")) {
fl->currentFlags |= RPMFILE_NOREPLACE; fl->currentFlags |= RPMFILE_NOREPLACE;
} else { } else {
rpmError(RPMERR_BADSPEC, _("Invalid %s token: %s\n"), name, p); rpmlog(RPMERR_BADSPEC, _("Invalid %s token: %s\n"), name, p);
fl->processingFailed = 1; fl->processingFailed = 1;
return RPMERR_BADSPEC; return RPMERR_BADSPEC;
} }
@ -680,7 +680,7 @@ static int parseForLang(char * buf, FileList fl)
SKIPSPACE(pe); SKIPSPACE(pe);
if (*pe != '(') { if (*pe != '(') {
rpmError(RPMERR_BADSPEC, _("Missing '(' in %s %s\n"), name, pe); rpmlog(RPMERR_BADSPEC, _("Missing '(' in %s %s\n"), name, pe);
fl->processingFailed = 1; fl->processingFailed = 1;
return RPMERR_BADSPEC; return RPMERR_BADSPEC;
} }
@ -691,7 +691,7 @@ static int parseForLang(char * buf, FileList fl)
{}; {};
if (*pe == '\0') { if (*pe == '\0') {
rpmError(RPMERR_BADSPEC, _("Missing ')' in %s(%s\n"), name, p); rpmlog(RPMERR_BADSPEC, _("Missing ')' in %s(%s\n"), name, p);
fl->processingFailed = 1; fl->processingFailed = 1;
return RPMERR_BADSPEC; return RPMERR_BADSPEC;
} }
@ -717,7 +717,7 @@ static int parseForLang(char * buf, FileList fl)
/* Sanity check on locale lengths */ /* Sanity check on locale lengths */
if (np < 1 || (np == 1 && *p != 'C') || np >= 32) { if (np < 1 || (np == 1 && *p != 'C') || np >= 32) {
rpmError(RPMERR_BADSPEC, rpmlog(RPMERR_BADSPEC,
_("Unusual locale length: \"%.*s\" in %%lang(%s)\n"), _("Unusual locale length: \"%.*s\" in %%lang(%s)\n"),
(int)np, p, q); (int)np, p, q);
fl->processingFailed = 1; fl->processingFailed = 1;
@ -729,7 +729,7 @@ static int parseForLang(char * buf, FileList fl)
for (i = 0; i < fl->nLangs; i++) { for (i = 0; i < fl->nLangs; i++) {
if (strncmp(fl->currentLangs[i], p, np)) if (strncmp(fl->currentLangs[i], p, np))
continue; continue;
rpmError(RPMERR_BADSPEC, _("Duplicate locale %.*s in %%lang(%s)\n"), rpmlog(RPMERR_BADSPEC, _("Duplicate locale %.*s in %%lang(%s)\n"),
(int)np, p, q); (int)np, p, q);
fl->processingFailed = 1; fl->processingFailed = 1;
return RPMERR_BADSPEC; return RPMERR_BADSPEC;
@ -844,7 +844,7 @@ static int parseForSimple(rpmSpec spec, Package pkg, char * buf,
if (!strcmp(s, "%docdir")) { if (!strcmp(s, "%docdir")) {
s = strtokWithQuotes(NULL, " \t\n"); s = strtokWithQuotes(NULL, " \t\n");
if (fl->docDirCount == MAXDOCDIR) { if (fl->docDirCount == MAXDOCDIR) {
rpmError(RPMERR_INTERNAL, _("Hit limit for %%docdir\n")); rpmlog(RPMERR_INTERNAL, _("Hit limit for %%docdir\n"));
fl->processingFailed = 1; fl->processingFailed = 1;
res = 1; res = 1;
} }
@ -852,7 +852,7 @@ static int parseForSimple(rpmSpec spec, Package pkg, char * buf,
if (s != NULL) if (s != NULL)
fl->docDirs[fl->docDirCount++] = xstrdup(s); fl->docDirs[fl->docDirCount++] = xstrdup(s);
if (s == NULL || strtokWithQuotes(NULL, " \t\n")) { if (s == NULL || strtokWithQuotes(NULL, " \t\n")) {
rpmError(RPMERR_INTERNAL, _("Only one arg for %%docdir\n")); rpmlog(RPMERR_INTERNAL, _("Only one arg for %%docdir\n"));
fl->processingFailed = 1; fl->processingFailed = 1;
res = 1; res = 1;
} }
@ -883,7 +883,7 @@ static int parseForSimple(rpmSpec spec, Package pkg, char * buf,
if (*fileName) { if (*fileName) {
/* We already got a file -- error */ /* We already got a file -- error */
rpmError(RPMERR_BADSPEC, _("Two files on one line: %s\n"), rpmlog(RPMERR_BADSPEC, _("Two files on one line: %s\n"),
*fileName); *fileName);
fl->processingFailed = 1; fl->processingFailed = 1;
res = 1; res = 1;
@ -900,7 +900,7 @@ static int parseForSimple(rpmSpec spec, Package pkg, char * buf,
*fileName = s; *fileName = s;
} else { } else {
/* not in %doc, does not begin with / -- error */ /* not in %doc, does not begin with / -- error */
rpmError(RPMERR_BADSPEC, rpmlog(RPMERR_BADSPEC,
_("File must begin with \"/\": %s\n"), s); _("File must begin with \"/\": %s\n"), s);
fl->processingFailed = 1; fl->processingFailed = 1;
res = 1; res = 1;
@ -912,7 +912,7 @@ static int parseForSimple(rpmSpec spec, Package pkg, char * buf,
if (specialDoc) { if (specialDoc) {
if (*fileName || (fl->currentFlags & ~(RPMFILE_DOC))) { if (*fileName || (fl->currentFlags & ~(RPMFILE_DOC))) {
rpmError(RPMERR_BADSPEC, rpmlog(RPMERR_BADSPEC,
_("Can't mix special %%doc with other forms: %s\n"), _("Can't mix special %%doc with other forms: %s\n"),
(*fileName ? *fileName : "")); (*fileName ? *fileName : ""));
fl->processingFailed = 1; fl->processingFailed = 1;
@ -931,7 +931,7 @@ static int parseForSimple(rpmSpec spec, Package pkg, char * buf,
} }
fmt = headerSprintf(pkg->header, _docdir_fmt, rpmTagTable, rpmHeaderFormats, &errstr); fmt = headerSprintf(pkg->header, _docdir_fmt, rpmTagTable, rpmHeaderFormats, &errstr);
if (!fmt) { if (!fmt) {
rpmError(RPMERR_BADSPEC, _("illegal _docdir_fmt: %s\n"), errstr); rpmlog(RPMERR_BADSPEC, _("illegal _docdir_fmt: %s\n"), errstr);
fl->processingFailed = 1; fl->processingFailed = 1;
res = 1; res = 1;
} }
@ -1207,7 +1207,7 @@ static void genCpioListAndHeader(FileList fl,
if (buf[0] == '/' && strcmp(buildRoot, "/") && if (buf[0] == '/' && strcmp(buildRoot, "/") &&
!strncmp(buf, buildRoot, strlen(buildRoot))) { !strncmp(buf, buildRoot, strlen(buildRoot))) {
rpmError(RPMERR_BADSPEC, rpmlog(RPMERR_BADSPEC,
_("Symlink points to BuildRoot: %s -> %s\n"), _("Symlink points to BuildRoot: %s -> %s\n"),
flp->fileURL, buf); flp->fileURL, buf);
fl->processingFailed = 1; fl->processingFailed = 1;
@ -1413,7 +1413,7 @@ static int addFile(FileList fl, const char * diskURL,
prefixTest++; prefixTest++;
} }
if (*prefixPtr || (*prefixTest && *prefixTest != '/')) { if (*prefixPtr || (*prefixTest && *prefixTest != '/')) {
rpmError(RPMERR_BADSPEC, _("File doesn't match prefix (%s): %s\n"), rpmlog(RPMERR_BADSPEC, _("File doesn't match prefix (%s): %s\n"),
fl->prefix, fileURL); fl->prefix, fileURL);
fl->processingFailed = 1; fl->processingFailed = 1;
return RPMERR_BADSPEC; return RPMERR_BADSPEC;
@ -1437,7 +1437,7 @@ static int addFile(FileList fl, const char * diskURL,
statp->st_mtime = now; statp->st_mtime = now;
statp->st_ctime = now; statp->st_ctime = now;
} else if (Lstat(diskURL, statp)) { } else if (Lstat(diskURL, statp)) {
rpmError(RPMERR_BADSPEC, _("File not found: %s\n"), diskURL); rpmlog(RPMERR_BADSPEC, _("File not found: %s\n"), diskURL);
fl->processingFailed = 1; fl->processingFailed = 1;
return RPMERR_BADSPEC; return RPMERR_BADSPEC;
} }
@ -1639,24 +1639,24 @@ static int processMetadataFile(Package pkg, FileList fl, const char * fileURL,
switch (tag) { switch (tag) {
default: default:
rpmError(RPMERR_BADSPEC, _("%s: can't load unknown tag (%d).\n"), rpmlog(RPMERR_BADSPEC, _("%s: can't load unknown tag (%d).\n"),
fn, tag); fn, tag);
goto exit; goto exit;
break; break;
case RPMTAG_PUBKEYS: case RPMTAG_PUBKEYS:
if ((rc = pgpReadPkts(fn, (const byte **)&pkt, (size_t *)&pktlen)) <= 0) { if ((rc = pgpReadPkts(fn, (const byte **)&pkt, (size_t *)&pktlen)) <= 0) {
rpmError(RPMERR_BADSPEC, _("%s: public key read failed.\n"), fn); rpmlog(RPMERR_BADSPEC, _("%s: public key read failed.\n"), fn);
goto exit; goto exit;
} }
if (rc != PGPARMOR_PUBKEY) { if (rc != PGPARMOR_PUBKEY) {
rpmError(RPMERR_BADSPEC, _("%s: not an armored public key.\n"), fn); rpmlog(RPMERR_BADSPEC, _("%s: not an armored public key.\n"), fn);
goto exit; goto exit;
} }
apkt = pgpArmorWrap(PGPARMOR_PUBKEY, pkt, pktlen); apkt = pgpArmorWrap(PGPARMOR_PUBKEY, pkt, pktlen);
break; break;
case RPMTAG_POLICIES: case RPMTAG_POLICIES:
if ((rc = rpmioSlurp(fn, &pkt, &pktlen)) != 0) { if ((rc = rpmioSlurp(fn, &pkt, &pktlen)) != 0) {
rpmError(RPMERR_BADSPEC, _("%s: *.te policy read failed.\n"), fn); rpmlog(RPMERR_BADSPEC, _("%s: *.te policy read failed.\n"), fn);
goto exit; goto exit;
} }
apkt = (const char *) pkt; /* XXX unsigned char */ apkt = (const char *) pkt; /* XXX unsigned char */
@ -1703,7 +1703,7 @@ static int processBinaryFile(Package pkg, FileList fl,
{ const char * fileName; { const char * fileName;
(void) urlPath(fileURL, &fileName); (void) urlPath(fileURL, &fileName);
if (*fileName != '/') { if (*fileName != '/') {
rpmError(RPMERR_BADSPEC, _("File needs leading \"/\": %s\n"), rpmlog(RPMERR_BADSPEC, _("File needs leading \"/\": %s\n"),
fileName); fileName);
rc = 1; rc = 1;
goto exit; goto exit;
@ -1727,7 +1727,7 @@ static int processBinaryFile(Package pkg, FileList fl,
/* XXX for %dev marker in file manifest only */ /* XXX for %dev marker in file manifest only */
if (fl->noGlob) { if (fl->noGlob) {
rpmError(RPMERR_BADSPEC, _("Glob not permitted: %s\n"), rpmlog(RPMERR_BADSPEC, _("Glob not permitted: %s\n"),
diskURL); diskURL);
rc = 1; rc = 1;
goto exit; goto exit;
@ -1741,7 +1741,7 @@ static int processBinaryFile(Package pkg, FileList fl,
} }
argv = _free(argv); argv = _free(argv);
} else { } else {
rpmError(RPMERR_BADSPEC, _("File not found by glob: %s\n"), rpmlog(RPMERR_BADSPEC, _("File not found by glob: %s\n"),
diskURL); diskURL);
rc = 1; rc = 1;
goto exit; goto exit;
@ -1793,7 +1793,7 @@ static int processPackageFiles(rpmSpec spec, Package pkg,
fd = Fopen(ffn, "r.fpio"); fd = Fopen(ffn, "r.fpio");
if (fd == NULL || Ferror(fd)) { if (fd == NULL || Ferror(fd)) {
rpmError(RPMERR_BADFILENAME, rpmlog(RPMERR_BADFILENAME,
_("Could not open %%files file %s: %s\n"), _("Could not open %%files file %s: %s\n"),
ffn, Fstrerror(fd)); ffn, Fstrerror(fd));
return RPMERR_BADFILENAME; return RPMERR_BADFILENAME;
@ -1805,7 +1805,7 @@ static int processPackageFiles(rpmSpec spec, Package pkg,
while (fgets(buf, sizeof(buf), f)) { while (fgets(buf, sizeof(buf), f)) {
handleComments(buf); handleComments(buf);
if (expandMacros(spec, spec->macros, buf, sizeof(buf))) { if (expandMacros(spec, spec->macros, buf, sizeof(buf))) {
rpmError(RPMERR_BADSPEC, _("line: %s\n"), buf); rpmlog(RPMERR_BADSPEC, _("line: %s\n"), buf);
return RPMERR_BADSPEC; return RPMERR_BADSPEC;
} }
appendStringBuf(pkg->fileList, buf); appendStringBuf(pkg->fileList, buf);
@ -2188,7 +2188,7 @@ int processSourceFiles(rpmSpec spec)
flp->verifyFlags = RPMVERIFY_ALL; flp->verifyFlags = RPMVERIFY_ALL;
if (Stat(diskURL, &flp->fl_st)) { if (Stat(diskURL, &flp->fl_st)) {
rpmError(RPMERR_BADSPEC, _("Bad file: %s: %s\n"), rpmlog(RPMERR_BADSPEC, _("Bad file: %s: %s\n"),
diskURL, strerror(errno)); diskURL, strerror(errno));
fl.processingFailed = 1; fl.processingFailed = 1;
} }
@ -2212,7 +2212,7 @@ int processSourceFiles(rpmSpec spec)
fl.totalFileSize += flp->fl_size; fl.totalFileSize += flp->fl_size;
if (! (flp->uname && flp->gname)) { if (! (flp->uname && flp->gname)) {
rpmError(RPMERR_BADSPEC, _("Bad owner/group: %s\n"), diskURL); rpmlog(RPMERR_BADSPEC, _("Bad owner/group: %s\n"), diskURL);
fl.processingFailed = 1; fl.processingFailed = 1;
} }

View File

@ -73,10 +73,10 @@ static int cpio_doio(FD_t fdo, Header h, CSA_t csa,
if (rc) { if (rc) {
if (failedFile) if (failedFile)
rpmError(RPMERR_CPIO, _("create archive failed on file %s: %s\n"), rpmlog(RPMERR_CPIO, _("create archive failed on file %s: %s\n"),
failedFile, cpioStrerror(rc)); failedFile, cpioStrerror(rc));
else else
rpmError(RPMERR_CPIO, _("create archive failed: %s\n"), rpmlog(RPMERR_CPIO, _("create archive failed: %s\n"),
cpioStrerror(rc)); cpioStrerror(rc));
rc = 1; rc = 1;
} }
@ -96,14 +96,14 @@ static int cpio_copy(FD_t fdo, CSA_t csa)
while((nb = Fread(buf, sizeof(buf[0]), sizeof(buf), csa->cpioFdIn)) > 0) { while((nb = Fread(buf, sizeof(buf[0]), sizeof(buf), csa->cpioFdIn)) > 0) {
if (Fwrite(buf, sizeof(buf[0]), nb, fdo) != nb) { if (Fwrite(buf, sizeof(buf[0]), nb, fdo) != nb) {
rpmError(RPMERR_CPIO, _("cpio_copy write failed: %s\n"), rpmlog(RPMERR_CPIO, _("cpio_copy write failed: %s\n"),
Fstrerror(fdo)); Fstrerror(fdo));
return 1; return 1;
} }
csa->cpioArchiveSize += nb; csa->cpioArchiveSize += nb;
} }
if (Ferror(csa->cpioFdIn)) { if (Ferror(csa->cpioFdIn)) {
rpmError(RPMERR_CPIO, _("cpio_copy read failed: %s\n"), rpmlog(RPMERR_CPIO, _("cpio_copy read failed: %s\n"),
Fstrerror(csa->cpioFdIn)); Fstrerror(csa->cpioFdIn));
return 1; return 1;
} }
@ -133,7 +133,7 @@ static StringBuf addFileToTagAux(rpmSpec spec,
while (fgets(buf, sizeof(buf), f)) { while (fgets(buf, sizeof(buf), f)) {
/* XXX display fn in error msg */ /* XXX display fn in error msg */
if (expandMacros(spec, spec->macros, buf, sizeof(buf))) { if (expandMacros(spec, spec->macros, buf, sizeof(buf))) {
rpmError(RPMERR_BADSPEC, _("line: %s\n"), buf); rpmlog(RPMERR_BADSPEC, _("line: %s\n"), buf);
sb = freeStringBuf(sb); sb = freeStringBuf(sb);
break; break;
} }
@ -191,42 +191,42 @@ static int processScriptFiles(rpmSpec spec, Package pkg)
if (pkg->preInFile) { if (pkg->preInFile) {
if (addFileToTag(spec, pkg->preInFile, pkg->header, RPMTAG_PREIN)) { if (addFileToTag(spec, pkg->preInFile, pkg->header, RPMTAG_PREIN)) {
rpmError(RPMERR_BADFILENAME, rpmlog(RPMERR_BADFILENAME,
_("Could not open PreIn file: %s\n"), pkg->preInFile); _("Could not open PreIn file: %s\n"), pkg->preInFile);
return RPMERR_BADFILENAME; return RPMERR_BADFILENAME;
} }
} }
if (pkg->preUnFile) { if (pkg->preUnFile) {
if (addFileToTag(spec, pkg->preUnFile, pkg->header, RPMTAG_PREUN)) { if (addFileToTag(spec, pkg->preUnFile, pkg->header, RPMTAG_PREUN)) {
rpmError(RPMERR_BADFILENAME, rpmlog(RPMERR_BADFILENAME,
_("Could not open PreUn file: %s\n"), pkg->preUnFile); _("Could not open PreUn file: %s\n"), pkg->preUnFile);
return RPMERR_BADFILENAME; return RPMERR_BADFILENAME;
} }
} }
if (pkg->preTransFile) { if (pkg->preTransFile) {
if (addFileToTag(spec, pkg->preTransFile, pkg->header, RPMTAG_PRETRANS)) { if (addFileToTag(spec, pkg->preTransFile, pkg->header, RPMTAG_PRETRANS)) {
rpmError(RPMERR_BADFILENAME, rpmlog(RPMERR_BADFILENAME,
_("Could not open PreIn file: %s\n"), pkg->preTransFile); _("Could not open PreIn file: %s\n"), pkg->preTransFile);
return RPMERR_BADFILENAME; return RPMERR_BADFILENAME;
} }
} }
if (pkg->postInFile) { if (pkg->postInFile) {
if (addFileToTag(spec, pkg->postInFile, pkg->header, RPMTAG_POSTIN)) { if (addFileToTag(spec, pkg->postInFile, pkg->header, RPMTAG_POSTIN)) {
rpmError(RPMERR_BADFILENAME, rpmlog(RPMERR_BADFILENAME,
_("Could not open PostIn file: %s\n"), pkg->postInFile); _("Could not open PostIn file: %s\n"), pkg->postInFile);
return RPMERR_BADFILENAME; return RPMERR_BADFILENAME;
} }
} }
if (pkg->postUnFile) { if (pkg->postUnFile) {
if (addFileToTag(spec, pkg->postUnFile, pkg->header, RPMTAG_POSTUN)) { if (addFileToTag(spec, pkg->postUnFile, pkg->header, RPMTAG_POSTUN)) {
rpmError(RPMERR_BADFILENAME, rpmlog(RPMERR_BADFILENAME,
_("Could not open PostUn file: %s\n"), pkg->postUnFile); _("Could not open PostUn file: %s\n"), pkg->postUnFile);
return RPMERR_BADFILENAME; return RPMERR_BADFILENAME;
} }
} }
if (pkg->postTransFile) { if (pkg->postTransFile) {
if (addFileToTag(spec, pkg->postTransFile, pkg->header, RPMTAG_POSTTRANS)) { if (addFileToTag(spec, pkg->postTransFile, pkg->header, RPMTAG_POSTTRANS)) {
rpmError(RPMERR_BADFILENAME, rpmlog(RPMERR_BADFILENAME,
_("Could not open PostUn file: %s\n"), pkg->postTransFile); _("Could not open PostUn file: %s\n"), pkg->postTransFile);
return RPMERR_BADFILENAME; return RPMERR_BADFILENAME;
} }
@ -234,7 +234,7 @@ static int processScriptFiles(rpmSpec spec, Package pkg)
if (pkg->verifyFile) { if (pkg->verifyFile) {
if (addFileToTag(spec, pkg->verifyFile, pkg->header, if (addFileToTag(spec, pkg->verifyFile, pkg->header,
RPMTAG_VERIFYSCRIPT)) { RPMTAG_VERIFYSCRIPT)) {
rpmError(RPMERR_BADFILENAME, rpmlog(RPMERR_BADFILENAME,
_("Could not open VerifyScript file: %s\n"), pkg->verifyFile); _("Could not open VerifyScript file: %s\n"), pkg->verifyFile);
return RPMERR_BADFILENAME; return RPMERR_BADFILENAME;
} }
@ -249,7 +249,7 @@ static int processScriptFiles(rpmSpec spec, Package pkg)
} else if (p->fileName) { } else if (p->fileName) {
if (addFileToArrayTag(spec, p->fileName, pkg->header, if (addFileToArrayTag(spec, p->fileName, pkg->header,
RPMTAG_TRIGGERSCRIPTS)) { RPMTAG_TRIGGERSCRIPTS)) {
rpmError(RPMERR_BADFILENAME, rpmlog(RPMERR_BADFILENAME,
_("Could not open Trigger script file: %s\n"), _("Could not open Trigger script file: %s\n"),
p->fileName); p->fileName);
return RPMERR_BADFILENAME; return RPMERR_BADFILENAME;
@ -278,7 +278,7 @@ int readRPM(const char *fileName, rpmSpec *specp, struct rpmlead *lead,
: fdDup(STDIN_FILENO); : fdDup(STDIN_FILENO);
if (fdi == NULL || Ferror(fdi)) { if (fdi == NULL || Ferror(fdi)) {
rpmError(RPMERR_BADMAGIC, _("readRPM: open %s: %s\n"), rpmlog(RPMERR_BADMAGIC, _("readRPM: open %s: %s\n"),
(fileName ? fileName : "<stdin>"), (fileName ? fileName : "<stdin>"),
Fstrerror(fdi)); Fstrerror(fdi));
if (fdi) (void) Fclose(fdi); if (fdi) (void) Fclose(fdi);
@ -287,7 +287,7 @@ int readRPM(const char *fileName, rpmSpec *specp, struct rpmlead *lead,
/* Get copy of lead */ /* Get copy of lead */
if ((rc = Fread(lead, sizeof(char), sizeof(*lead), fdi)) != sizeof(*lead)) { if ((rc = Fread(lead, sizeof(char), sizeof(*lead), fdi)) != sizeof(*lead)) {
rpmError(RPMERR_BADMAGIC, _("readRPM: read %s: %s\n"), rpmlog(RPMERR_BADMAGIC, _("readRPM: read %s: %s\n"),
(fileName ? fileName : "<stdin>"), (fileName ? fileName : "<stdin>"),
Fstrerror(fdi)); Fstrerror(fdi));
return RPMERR_BADMAGIC; return RPMERR_BADMAGIC;
@ -295,7 +295,7 @@ int readRPM(const char *fileName, rpmSpec *specp, struct rpmlead *lead,
/* XXX FIXME: EPIPE on <stdin> */ /* XXX FIXME: EPIPE on <stdin> */
if (Fseek(fdi, 0, SEEK_SET) == -1) { if (Fseek(fdi, 0, SEEK_SET) == -1) {
rpmError(RPMERR_FSEEK, _("%s: Fseek failed: %s\n"), rpmlog(RPMERR_FSEEK, _("%s: Fseek failed: %s\n"),
(fileName ? fileName : "<stdin>"), Fstrerror(fdi)); (fileName ? fileName : "<stdin>"), Fstrerror(fdi));
return RPMERR_FSEEK; return RPMERR_FSEEK;
} }
@ -326,12 +326,12 @@ int readRPM(const char *fileName, rpmSpec *specp, struct rpmlead *lead,
case RPMRC_NOTTRUSTED: case RPMRC_NOTTRUSTED:
break; break;
case RPMRC_NOTFOUND: case RPMRC_NOTFOUND:
rpmError(RPMERR_BADMAGIC, _("readRPM: %s is not an RPM package\n"), rpmlog(RPMERR_BADMAGIC, _("readRPM: %s is not an RPM package\n"),
(fileName ? fileName : "<stdin>")); (fileName ? fileName : "<stdin>"));
return RPMERR_BADMAGIC; return RPMERR_BADMAGIC;
case RPMRC_FAIL: case RPMRC_FAIL:
default: default:
rpmError(RPMERR_BADMAGIC, _("readRPM: reading header from %s\n"), rpmlog(RPMERR_BADMAGIC, _("readRPM: reading header from %s\n"),
(fileName ? fileName : "<stdin>")); (fileName ? fileName : "<stdin>"));
return RPMERR_BADMAGIC; return RPMERR_BADMAGIC;
break; break;
@ -455,7 +455,7 @@ int writeRPM(Header *hdrp, unsigned char ** pkgidp, const char *fileName,
h = headerReload(h, RPMTAG_HEADERIMMUTABLE); h = headerReload(h, RPMTAG_HEADERIMMUTABLE);
if (h == NULL) { /* XXX can't happen */ if (h == NULL) { /* XXX can't happen */
rc = RPMERR_RELOAD; rc = RPMERR_RELOAD;
rpmError(RPMERR_RELOAD, _("Unable to create immutable header region.\n")); rpmlog(RPMERR_RELOAD, _("Unable to create immutable header region.\n"));
goto exit; goto exit;
} }
/* Re-reference reallocated header. */ /* Re-reference reallocated header. */
@ -467,14 +467,14 @@ int writeRPM(Header *hdrp, unsigned char ** pkgidp, const char *fileName,
*/ */
if (makeTempFile(NULL, &sigtarget, &fd)) { if (makeTempFile(NULL, &sigtarget, &fd)) {
rc = RPMERR_CREATE; rc = RPMERR_CREATE;
rpmError(RPMERR_CREATE, _("Unable to open temp file.\n")); rpmlog(RPMERR_CREATE, _("Unable to open temp file.\n"));
goto exit; goto exit;
} }
fdInitDigest(fd, PGPHASHALGO_SHA1, 0); fdInitDigest(fd, PGPHASHALGO_SHA1, 0);
if (headerWrite(fd, h, HEADER_MAGIC_YES)) { if (headerWrite(fd, h, HEADER_MAGIC_YES)) {
rc = RPMERR_NOSPACE; rc = RPMERR_NOSPACE;
rpmError(RPMERR_NOSPACE, _("Unable to write temp header\n")); rpmlog(RPMERR_NOSPACE, _("Unable to write temp header\n"));
} else { /* Write the archive and get the size */ } else { /* Write the archive and get the size */
(void) Fflush(fd); (void) Fflush(fd);
fdFiniDigest(fd, PGPHASHALGO_SHA1, (void **)&SHA1, NULL, 1); fdFiniDigest(fd, PGPHASHALGO_SHA1, (void **)&SHA1, NULL, 1);
@ -484,7 +484,7 @@ int writeRPM(Header *hdrp, unsigned char ** pkgidp, const char *fileName,
rc = cpio_copy(fd, csa); rc = cpio_copy(fd, csa);
} else { } else {
rc = RPMERR_BADARG; rc = RPMERR_BADARG;
rpmError(RPMERR_BADARG, _("Bad CSA data\n")); rpmlog(RPMERR_BADARG, _("Bad CSA data\n"));
} }
} }
rpmio_flags = _free(rpmio_flags); rpmio_flags = _free(rpmio_flags);
@ -513,14 +513,14 @@ int writeRPM(Header *hdrp, unsigned char ** pkgidp, const char *fileName,
(void) Fflush(fd); (void) Fflush(fd);
if (Fseek(fd, 0, SEEK_SET) == -1) { if (Fseek(fd, 0, SEEK_SET) == -1) {
rc = RPMERR_FSEEK; rc = RPMERR_FSEEK;
rpmError(RPMERR_FSEEK, _("%s: Fseek failed: %s\n"), rpmlog(RPMERR_FSEEK, _("%s: Fseek failed: %s\n"),
sigtarget, Fstrerror(fd)); sigtarget, Fstrerror(fd));
} }
fdInitDigest(fd, PGPHASHALGO_SHA1, 0); fdInitDigest(fd, PGPHASHALGO_SHA1, 0);
if (headerWrite(fd, h, HEADER_MAGIC_YES)) { if (headerWrite(fd, h, HEADER_MAGIC_YES)) {
rc = RPMERR_NOSPACE; rc = RPMERR_NOSPACE;
rpmError(RPMERR_NOSPACE, _("Unable to write final header\n")); rpmlog(RPMERR_NOSPACE, _("Unable to write final header\n"));
} }
(void) Fflush(fd); (void) Fflush(fd);
fdFiniDigest(fd, PGPHASHALGO_SHA1, (void **)&SHA1, NULL, 1); fdFiniDigest(fd, PGPHASHALGO_SHA1, (void **)&SHA1, NULL, 1);
@ -558,7 +558,7 @@ int writeRPM(Header *hdrp, unsigned char ** pkgidp, const char *fileName,
sig = headerReload(sig, RPMTAG_HEADERSIGNATURES); sig = headerReload(sig, RPMTAG_HEADERSIGNATURES);
if (sig == NULL) { /* XXX can't happen */ if (sig == NULL) { /* XXX can't happen */
rc = RPMERR_RELOAD; rc = RPMERR_RELOAD;
rpmError(RPMERR_RELOAD, _("Unable to reload signature header.\n")); rpmlog(RPMERR_RELOAD, _("Unable to reload signature header.\n"));
goto exit; goto exit;
} }
@ -566,7 +566,7 @@ int writeRPM(Header *hdrp, unsigned char ** pkgidp, const char *fileName,
fd = Fopen(fileName, "w.ufdio"); fd = Fopen(fileName, "w.ufdio");
if (fd == NULL || Ferror(fd)) { if (fd == NULL || Ferror(fd)) {
rc = RPMERR_CREATE; rc = RPMERR_CREATE;
rpmError(RPMERR_CREATE, _("Could not open %s: %s\n"), rpmlog(RPMERR_CREATE, _("Could not open %s: %s\n"),
fileName, Fstrerror(fd)); fileName, Fstrerror(fd));
goto exit; goto exit;
} }
@ -602,7 +602,7 @@ int writeRPM(Header *hdrp, unsigned char ** pkgidp, const char *fileName,
if (writeLead(fd, &lead) != RPMRC_OK) { if (writeLead(fd, &lead) != RPMRC_OK) {
rc = RPMERR_NOSPACE; rc = RPMERR_NOSPACE;
rpmError(RPMERR_NOSPACE, _("Unable to write package: %s\n"), rpmlog(RPMERR_NOSPACE, _("Unable to write package: %s\n"),
Fstrerror(fd)); Fstrerror(fd));
goto exit; goto exit;
} }
@ -617,7 +617,7 @@ int writeRPM(Header *hdrp, unsigned char ** pkgidp, const char *fileName,
ifd = Fopen(sigtarget, "r.ufdio"); ifd = Fopen(sigtarget, "r.ufdio");
if (ifd == NULL || Ferror(ifd)) { if (ifd == NULL || Ferror(ifd)) {
rc = RPMERR_READ; rc = RPMERR_READ;
rpmError(RPMERR_READ, _("Unable to open sigtarget %s: %s\n"), rpmlog(RPMERR_READ, _("Unable to open sigtarget %s: %s\n"),
sigtarget, Fstrerror(ifd)); sigtarget, Fstrerror(ifd));
goto exit; goto exit;
} }
@ -628,7 +628,7 @@ int writeRPM(Header *hdrp, unsigned char ** pkgidp, const char *fileName,
if (nh == NULL) { if (nh == NULL) {
rc = RPMERR_READ; rc = RPMERR_READ;
rpmError(RPMERR_READ, _("Unable to read header from %s: %s\n"), rpmlog(RPMERR_READ, _("Unable to read header from %s: %s\n"),
sigtarget, Fstrerror(ifd)); sigtarget, Fstrerror(ifd));
goto exit; goto exit;
} }
@ -642,7 +642,7 @@ int writeRPM(Header *hdrp, unsigned char ** pkgidp, const char *fileName,
if (rc) { if (rc) {
rc = RPMERR_NOSPACE; rc = RPMERR_NOSPACE;
rpmError(RPMERR_NOSPACE, _("Unable to write header to %s: %s\n"), rpmlog(RPMERR_NOSPACE, _("Unable to write header to %s: %s\n"),
fileName, Fstrerror(fd)); fileName, Fstrerror(fd));
goto exit; goto exit;
} }
@ -652,13 +652,13 @@ int writeRPM(Header *hdrp, unsigned char ** pkgidp, const char *fileName,
while ((count = Fread(buf, sizeof(buf[0]), sizeof(buf), ifd)) > 0) { while ((count = Fread(buf, sizeof(buf[0]), sizeof(buf), ifd)) > 0) {
if (count == -1) { if (count == -1) {
rc = RPMERR_READ; rc = RPMERR_READ;
rpmError(RPMERR_READ, _("Unable to read payload from %s: %s\n"), rpmlog(RPMERR_READ, _("Unable to read payload from %s: %s\n"),
sigtarget, Fstrerror(ifd)); sigtarget, Fstrerror(ifd));
goto exit; goto exit;
} }
if (Fwrite(buf, sizeof(buf[0]), count, fd) != count) { if (Fwrite(buf, sizeof(buf[0]), count, fd) != count) {
rc = RPMERR_NOSPACE; rc = RPMERR_NOSPACE;
rpmError(RPMERR_NOSPACE, _("Unable to write payload to %s: %s\n"), rpmlog(RPMERR_NOSPACE, _("Unable to write payload to %s: %s\n"),
fileName, Fstrerror(fd)); fileName, Fstrerror(fd));
goto exit; goto exit;
} }
@ -765,7 +765,7 @@ int packageBinaries(rpmSpec spec)
if (binRpm == NULL) { if (binRpm == NULL) {
const char *name; const char *name;
(void) headerNVR(pkg->header, &name, NULL, NULL); (void) headerNVR(pkg->header, &name, NULL, NULL);
rpmError(RPMERR_BADFILENAME, _("Could not generate output " rpmlog(RPMERR_BADFILENAME, _("Could not generate output "
"filename for package %s: %s\n"), name, errorString); "filename for package %s: %s\n"), name, errorString);
return RPMERR_BADFILENAME; return RPMERR_BADFILENAME;
} }
@ -781,7 +781,7 @@ int packageBinaries(rpmSpec spec)
if (Mkdir(dn, 0755) == 0) if (Mkdir(dn, 0755) == 0)
break; break;
default: default:
rpmError(RPMERR_BADFILENAME,_("cannot create %s: %s\n"), rpmlog(RPMERR_BADFILENAME,_("cannot create %s: %s\n"),
dn, strerror(errno)); dn, strerror(errno));
break; break;
} }

View File

@ -29,7 +29,7 @@ int parseBuildInstallClean(rpmSpec spec, rpmParseState parsePart)
} }
if (*sbp != NULL) { if (*sbp != NULL) {
rpmError(RPMERR_BADSPEC, _("line %d: second %s\n"), rpmlog(RPMERR_BADSPEC, _("line %d: second %s\n"),
spec->lineNum, name); spec->lineNum, name);
return RPMERR_BADSPEC; return RPMERR_BADSPEC;
} }

View File

@ -119,7 +119,7 @@ static int addChangelog(Header h, StringBuf sb)
while (*s != '\0') { while (*s != '\0') {
if (*s != '*') { if (*s != '*') {
rpmError(RPMERR_BADSPEC, rpmlog(RPMERR_BADSPEC,
_("%%changelog entries must start with *\n")); _("%%changelog entries must start with *\n"));
return RPMERR_BADSPEC; return RPMERR_BADSPEC;
} }
@ -128,7 +128,7 @@ static int addChangelog(Header h, StringBuf sb)
date = s; date = s;
while(*s && *s != '\n') s++; while(*s && *s != '\n') s++;
if (! *s) { if (! *s) {
rpmError(RPMERR_BADSPEC, _("incomplete %%changelog entry\n")); rpmlog(RPMERR_BADSPEC, _("incomplete %%changelog entry\n"));
return RPMERR_BADSPEC; return RPMERR_BADSPEC;
} }
*s = '\0'; *s = '\0';
@ -143,11 +143,11 @@ static int addChangelog(Header h, StringBuf sb)
} }
SKIPSPACE(date); SKIPSPACE(date);
if (dateToTimet(date, &time)) { if (dateToTimet(date, &time)) {
rpmError(RPMERR_BADSPEC, _("bad date in %%changelog: %s\n"), date); rpmlog(RPMERR_BADSPEC, _("bad date in %%changelog: %s\n"), date);
return RPMERR_BADSPEC; return RPMERR_BADSPEC;
} }
if (lastTime && lastTime < time) { if (lastTime && lastTime < time) {
rpmError(RPMERR_BADSPEC, rpmlog(RPMERR_BADSPEC,
_("%%changelog not in descending chronological order\n")); _("%%changelog not in descending chronological order\n"));
return RPMERR_BADSPEC; return RPMERR_BADSPEC;
} }
@ -156,7 +156,7 @@ static int addChangelog(Header h, StringBuf sb)
/* skip space to the name */ /* skip space to the name */
SKIPSPACE(s); SKIPSPACE(s);
if (! *s) { if (! *s) {
rpmError(RPMERR_BADSPEC, _("missing name in %%changelog\n")); rpmlog(RPMERR_BADSPEC, _("missing name in %%changelog\n"));
return RPMERR_BADSPEC; return RPMERR_BADSPEC;
} }
@ -167,14 +167,14 @@ static int addChangelog(Header h, StringBuf sb)
*s-- = '\0'; *s-- = '\0';
} }
if (s == name) { if (s == name) {
rpmError(RPMERR_BADSPEC, _("missing name in %%changelog\n")); rpmlog(RPMERR_BADSPEC, _("missing name in %%changelog\n"));
return RPMERR_BADSPEC; return RPMERR_BADSPEC;
} }
/* text */ /* text */
SKIPSPACE(text); SKIPSPACE(text);
if (! *text) { if (! *text) {
rpmError(RPMERR_BADSPEC, _("no description in %%changelog\n")); rpmlog(RPMERR_BADSPEC, _("no description in %%changelog\n"));
return RPMERR_BADSPEC; return RPMERR_BADSPEC;
} }

View File

@ -36,7 +36,7 @@ int parseDescription(rpmSpec spec)
lang = RPMBUILD_DEFAULT_LANG; lang = RPMBUILD_DEFAULT_LANG;
if ((rc = poptParseArgvString(spec->line, &argc, &argv))) { if ((rc = poptParseArgvString(spec->line, &argc, &argv))) {
rpmError(RPMERR_BADSPEC, _("line %d: Error parsing %%description: %s\n"), rpmlog(RPMERR_BADSPEC, _("line %d: Error parsing %%description: %s\n"),
spec->lineNum, poptStrerror(rc)); spec->lineNum, poptStrerror(rc));
return RPMERR_BADSPEC; return RPMERR_BADSPEC;
} }
@ -49,7 +49,7 @@ int parseDescription(rpmSpec spec)
} }
if (arg < -1) { if (arg < -1) {
rpmError(RPMERR_BADSPEC, _("line %d: Bad option %s: %s\n"), rpmlog(RPMERR_BADSPEC, _("line %d: Bad option %s: %s\n"),
spec->lineNum, spec->lineNum,
poptBadOption(optCon, POPT_BADOPTION_NOALIAS), poptBadOption(optCon, POPT_BADOPTION_NOALIAS),
spec->line); spec->line);
@ -60,7 +60,7 @@ int parseDescription(rpmSpec spec)
if (name == NULL) if (name == NULL)
name = poptGetArg(optCon); name = poptGetArg(optCon);
if (poptPeekArg(optCon)) { if (poptPeekArg(optCon)) {
rpmError(RPMERR_BADSPEC, _("line %d: Too many names: %s\n"), rpmlog(RPMERR_BADSPEC, _("line %d: Too many names: %s\n"),
spec->lineNum, spec->lineNum,
spec->line); spec->line);
goto exit; goto exit;
@ -68,7 +68,7 @@ int parseDescription(rpmSpec spec)
} }
if (lookupPackage(spec, name, flag, &pkg)) { if (lookupPackage(spec, name, flag, &pkg)) {
rpmError(RPMERR_BADSPEC, _("line %d: Package does not exist: %s\n"), rpmlog(RPMERR_BADSPEC, _("line %d: Package does not exist: %s\n"),
spec->lineNum, spec->line); spec->lineNum, spec->line);
goto exit; goto exit;
} }
@ -78,7 +78,7 @@ int parseDescription(rpmSpec spec)
#if 0 #if 0
if (headerIsEntry(pkg->header, RPMTAG_DESCRIPTION)) { if (headerIsEntry(pkg->header, RPMTAG_DESCRIPTION)) {
rpmError(RPMERR_BADSPEC, _("line %d: Second description\n"), rpmlog(RPMERR_BADSPEC, _("line %d: Second description\n"),
spec->lineNum); spec->lineNum);
goto exit; goto exit;
} }

View File

@ -31,7 +31,7 @@ int parseFiles(rpmSpec spec)
file = NULL; file = NULL;
if ((rc = poptParseArgvString(spec->line, &argc, &argv))) { if ((rc = poptParseArgvString(spec->line, &argc, &argv))) {
rpmError(RPMERR_BADSPEC, _("line %d: Error parsing %%files: %s\n"), rpmlog(RPMERR_BADSPEC, _("line %d: Error parsing %%files: %s\n"),
spec->lineNum, poptStrerror(rc)); spec->lineNum, poptStrerror(rc));
rc = RPMERR_BADSPEC; rc = RPMERR_BADSPEC;
goto exit; goto exit;
@ -45,7 +45,7 @@ int parseFiles(rpmSpec spec)
} }
if (arg < -1) { if (arg < -1) {
rpmError(RPMERR_BADSPEC, _("line %d: Bad option %s: %s\n"), rpmlog(RPMERR_BADSPEC, _("line %d: Bad option %s: %s\n"),
spec->lineNum, spec->lineNum,
poptBadOption(optCon, POPT_BADOPTION_NOALIAS), poptBadOption(optCon, POPT_BADOPTION_NOALIAS),
spec->line); spec->line);
@ -57,7 +57,7 @@ int parseFiles(rpmSpec spec)
if (name == NULL) if (name == NULL)
name = poptGetArg(optCon); name = poptGetArg(optCon);
if (poptPeekArg(optCon)) { if (poptPeekArg(optCon)) {
rpmError(RPMERR_BADSPEC, _("line %d: Too many names: %s\n"), rpmlog(RPMERR_BADSPEC, _("line %d: Too many names: %s\n"),
spec->lineNum, spec->lineNum,
spec->line); spec->line);
rc = RPMERR_BADSPEC; rc = RPMERR_BADSPEC;
@ -66,14 +66,14 @@ int parseFiles(rpmSpec spec)
} }
if (lookupPackage(spec, name, flag, &pkg)) { if (lookupPackage(spec, name, flag, &pkg)) {
rpmError(RPMERR_BADSPEC, _("line %d: Package does not exist: %s\n"), rpmlog(RPMERR_BADSPEC, _("line %d: Package does not exist: %s\n"),
spec->lineNum, spec->line); spec->lineNum, spec->line);
rc = RPMERR_BADSPEC; rc = RPMERR_BADSPEC;
goto exit; goto exit;
} }
if (pkg->fileList != NULL) { if (pkg->fileList != NULL) {
rpmError(RPMERR_BADSPEC, _("line %d: Second %%files list\n"), rpmlog(RPMERR_BADSPEC, _("line %d: Second %%files list\n"),
spec->lineNum); spec->lineNum);
rc = RPMERR_BADSPEC; rc = RPMERR_BADSPEC;
goto exit; goto exit;

View File

@ -217,22 +217,22 @@ static int checkForValidArchitectures(rpmSpec spec)
if (isMemberInEntry(spec->buildRestrictions, if (isMemberInEntry(spec->buildRestrictions,
arch, RPMTAG_EXCLUDEARCH) == 1) { arch, RPMTAG_EXCLUDEARCH) == 1) {
rpmError(RPMERR_BADSPEC, _("Architecture is excluded: %s\n"), arch); rpmlog(RPMERR_BADSPEC, _("Architecture is excluded: %s\n"), arch);
return RPMERR_BADSPEC; return RPMERR_BADSPEC;
} }
if (isMemberInEntry(spec->buildRestrictions, if (isMemberInEntry(spec->buildRestrictions,
arch, RPMTAG_EXCLUSIVEARCH) == 0) { arch, RPMTAG_EXCLUSIVEARCH) == 0) {
rpmError(RPMERR_BADSPEC, _("Architecture is not included: %s\n"), arch); rpmlog(RPMERR_BADSPEC, _("Architecture is not included: %s\n"), arch);
return RPMERR_BADSPEC; return RPMERR_BADSPEC;
} }
if (isMemberInEntry(spec->buildRestrictions, if (isMemberInEntry(spec->buildRestrictions,
os, RPMTAG_EXCLUDEOS) == 1) { os, RPMTAG_EXCLUDEOS) == 1) {
rpmError(RPMERR_BADSPEC, _("OS is excluded: %s\n"), os); rpmlog(RPMERR_BADSPEC, _("OS is excluded: %s\n"), os);
return RPMERR_BADSPEC; return RPMERR_BADSPEC;
} }
if (isMemberInEntry(spec->buildRestrictions, if (isMemberInEntry(spec->buildRestrictions,
os, RPMTAG_EXCLUSIVEOS) == 0) { os, RPMTAG_EXCLUSIVEOS) == 0) {
rpmError(RPMERR_BADSPEC, _("OS is not included: %s\n"), os); rpmlog(RPMERR_BADSPEC, _("OS is not included: %s\n"), os);
return RPMERR_BADSPEC; return RPMERR_BADSPEC;
} }
@ -253,7 +253,7 @@ static int checkForRequired(Header h, const char * NVR)
for (p = requiredTags; *p != 0; p++) { for (p = requiredTags; *p != 0; p++) {
if (!headerIsEntry(h, *p)) { if (!headerIsEntry(h, *p)) {
rpmError(RPMERR_BADSPEC, rpmlog(RPMERR_BADSPEC,
_("%s field must be present in package: %s\n"), _("%s field must be present in package: %s\n"),
rpmTagGetName(*p), NVR); rpmTagGetName(*p), NVR);
res = 1; res = 1;
@ -281,7 +281,7 @@ static int checkForDuplicates(Header h, const char * NVR)
{ {
if (tag != lastTag) if (tag != lastTag)
continue; continue;
rpmError(RPMERR_BADSPEC, _("Duplicate %s entries in package: %s\n"), rpmlog(RPMERR_BADSPEC, _("Duplicate %s entries in package: %s\n"),
rpmTagGetName(tag), NVR); rpmTagGetName(tag), NVR);
res = 1; res = 1;
} }
@ -335,7 +335,7 @@ static int readIcon(Header h, const char * file)
fd = Fopen(fn, "r.ufdio"); fd = Fopen(fn, "r.ufdio");
if (fd == NULL || Ferror(fd)) { if (fd == NULL || Ferror(fd)) {
rpmError(RPMERR_BADSPEC, _("Unable to open icon %s: %s\n"), rpmlog(RPMERR_BADSPEC, _("Unable to open icon %s: %s\n"),
fn, Fstrerror(fd)); fn, Fstrerror(fd));
rc = RPMERR_BADSPEC; rc = RPMERR_BADSPEC;
goto exit; goto exit;
@ -353,7 +353,7 @@ static int readIcon(Header h, const char * file)
nb = Fread(icon, sizeof(icon[0]), iconsize, fd); nb = Fread(icon, sizeof(icon[0]), iconsize, fd);
if (Ferror(fd) || (size >= 0 && nb != size)) { if (Ferror(fd) || (size >= 0 && nb != size)) {
rpmError(RPMERR_BADSPEC, _("Unable to read icon %s: %s\n"), rpmlog(RPMERR_BADSPEC, _("Unable to read icon %s: %s\n"),
fn, Fstrerror(fd)); fn, Fstrerror(fd));
rc = RPMERR_BADSPEC; rc = RPMERR_BADSPEC;
} }
@ -366,7 +366,7 @@ static int readIcon(Header h, const char * file)
} else if (! strncmp(icon, "/* XPM", sizeof("/* XPM")-1)) { } else if (! strncmp(icon, "/* XPM", sizeof("/* XPM")-1)) {
(void) headerAddEntry(h, RPMTAG_XPM, RPM_BIN_TYPE, icon, iconsize); (void) headerAddEntry(h, RPMTAG_XPM, RPM_BIN_TYPE, icon, iconsize);
} else { } else {
rpmError(RPMERR_BADSPEC, _("Unknown icon type: %s\n"), file); rpmlog(RPMERR_BADSPEC, _("Unknown icon type: %s\n"), file);
rc = RPMERR_BADSPEC; rc = RPMERR_BADSPEC;
goto exit; goto exit;
} }
@ -408,7 +408,7 @@ spectag stashSt(rpmSpec spec, Header h, int tag, const char * lang)
#define SINGLE_TOKEN_ONLY \ #define SINGLE_TOKEN_ONLY \
if (multiToken) { \ if (multiToken) { \
rpmError(RPMERR_BADSPEC, _("line %d: Tag takes single token only: %s\n"), \ rpmlog(RPMERR_BADSPEC, _("line %d: Tag takes single token only: %s\n"), \
spec->lineNum, spec->line); \ spec->lineNum, spec->line); \
return RPMERR_BADSPEC; \ return RPMERR_BADSPEC; \
} }
@ -438,7 +438,7 @@ static int handlePreambleTag(rpmSpec spec, Package pkg, rpmTag tag,
while ((*field) && (*field != ':')) while ((*field) && (*field != ':'))
field++; field++;
if (*field != ':') { if (*field != ':') {
rpmError(RPMERR_BADSPEC, _("line %d: Malformed tag: %s\n"), rpmlog(RPMERR_BADSPEC, _("line %d: Malformed tag: %s\n"),
spec->lineNum, spec->line); spec->lineNum, spec->line);
return RPMERR_BADSPEC; return RPMERR_BADSPEC;
} }
@ -446,7 +446,7 @@ static int handlePreambleTag(rpmSpec spec, Package pkg, rpmTag tag,
SKIPSPACE(field); SKIPSPACE(field);
if (!*field) { if (!*field) {
/* Empty field */ /* Empty field */
rpmError(RPMERR_BADSPEC, _("line %d: Empty tag: %s\n"), rpmlog(RPMERR_BADSPEC, _("line %d: Empty tag: %s\n"),
spec->lineNum, spec->line); spec->lineNum, spec->line);
return RPMERR_BADSPEC; return RPMERR_BADSPEC;
} }
@ -471,14 +471,14 @@ static int handlePreambleTag(rpmSpec spec, Package pkg, rpmTag tag,
/* These macros are for backward compatibility */ /* These macros are for backward compatibility */
if (tag == RPMTAG_VERSION) { if (tag == RPMTAG_VERSION) {
if (strchr(field, '-') != NULL) { if (strchr(field, '-') != NULL) {
rpmError(RPMERR_BADSPEC, _("line %d: Illegal char '-' in %s: %s\n"), rpmlog(RPMERR_BADSPEC, _("line %d: Illegal char '-' in %s: %s\n"),
spec->lineNum, "version", spec->line); spec->lineNum, "version", spec->line);
return RPMERR_BADSPEC; return RPMERR_BADSPEC;
} }
addMacro(spec->macros, "PACKAGE_VERSION", NULL, field, RMIL_OLDSPEC); addMacro(spec->macros, "PACKAGE_VERSION", NULL, field, RMIL_OLDSPEC);
} else if (tag == RPMTAG_RELEASE) { } else if (tag == RPMTAG_RELEASE) {
if (strchr(field, '-') != NULL) { if (strchr(field, '-') != NULL) {
rpmError(RPMERR_BADSPEC, _("line %d: Illegal char '-' in %s: %s\n"), rpmlog(RPMERR_BADSPEC, _("line %d: Illegal char '-' in %s: %s\n"),
spec->lineNum, "release", spec->line); spec->lineNum, "release", spec->line);
return RPMERR_BADSPEC; return RPMERR_BADSPEC;
} }
@ -533,7 +533,7 @@ static int handlePreambleTag(rpmSpec spec, Package pkg, rpmTag tag,
(void) urlPath(buildRootURL, &buildRoot); (void) urlPath(buildRootURL, &buildRoot);
if (*buildRoot == '\0') buildRoot = "/"; if (*buildRoot == '\0') buildRoot = "/";
if (!strcmp(buildRoot, "/")) { if (!strcmp(buildRoot, "/")) {
rpmError(RPMERR_BADSPEC, rpmlog(RPMERR_BADSPEC,
_("BuildRoot can not be \"/\": %s\n"), spec->buildRootURL); _("BuildRoot can not be \"/\": %s\n"), spec->buildRootURL);
buildRootURL = _free(buildRootURL); buildRootURL = _free(buildRootURL);
return RPMERR_BADSPEC; return RPMERR_BADSPEC;
@ -546,7 +546,7 @@ static int handlePreambleTag(rpmSpec spec, Package pkg, rpmTag tag,
while (num--) { while (num--) {
len = strlen(array[num]); len = strlen(array[num]);
if (array[num][len - 1] == '/' && len > 1) { if (array[num][len - 1] == '/' && len > 1) {
rpmError(RPMERR_BADSPEC, rpmlog(RPMERR_BADSPEC,
_("line %d: Prefixes must not end with \"/\": %s\n"), _("line %d: Prefixes must not end with \"/\": %s\n"),
spec->lineNum, spec->line); spec->lineNum, spec->line);
array = hfd(array, type); array = hfd(array, type);
@ -558,7 +558,7 @@ static int handlePreambleTag(rpmSpec spec, Package pkg, rpmTag tag,
case RPMTAG_DOCDIR: case RPMTAG_DOCDIR:
SINGLE_TOKEN_ONLY; SINGLE_TOKEN_ONLY;
if (field[0] != '/') { if (field[0] != '/') {
rpmError(RPMERR_BADSPEC, rpmlog(RPMERR_BADSPEC,
_("line %d: Docdir must begin with '/': %s\n"), _("line %d: Docdir must begin with '/': %s\n"),
spec->lineNum, spec->line); spec->lineNum, spec->line);
return RPMERR_BADSPEC; return RPMERR_BADSPEC;
@ -570,7 +570,7 @@ static int handlePreambleTag(rpmSpec spec, Package pkg, rpmTag tag,
case RPMTAG_EPOCH: case RPMTAG_EPOCH:
SINGLE_TOKEN_ONLY; SINGLE_TOKEN_ONLY;
if (parseNum(field, &num)) { if (parseNum(field, &num)) {
rpmError(RPMERR_BADSPEC, rpmlog(RPMERR_BADSPEC,
_("line %d: Epoch/Serial field must be a number: %s\n"), _("line %d: Epoch/Serial field must be a number: %s\n"),
spec->lineNum, spec->line); spec->lineNum, spec->line);
return RPMERR_BADSPEC; return RPMERR_BADSPEC;
@ -610,7 +610,7 @@ static int handlePreambleTag(rpmSpec spec, Package pkg, rpmTag tag,
case RPMTAG_BUILDPREREQ: case RPMTAG_BUILDPREREQ:
case RPMTAG_BUILDREQUIRES: case RPMTAG_BUILDREQUIRES:
if ((rc = parseBits(lang, buildScriptBits, &tagflags))) { if ((rc = parseBits(lang, buildScriptBits, &tagflags))) {
rpmError(RPMERR_BADSPEC, rpmlog(RPMERR_BADSPEC,
_("line %d: Bad %s: qualifiers: %s\n"), _("line %d: Bad %s: qualifiers: %s\n"),
spec->lineNum, rpmTagGetName(tag), spec->line); spec->lineNum, rpmTagGetName(tag), spec->line);
return rc; return rc;
@ -621,7 +621,7 @@ static int handlePreambleTag(rpmSpec spec, Package pkg, rpmTag tag,
case RPMTAG_REQUIREFLAGS: case RPMTAG_REQUIREFLAGS:
case RPMTAG_PREREQ: case RPMTAG_PREREQ:
if ((rc = parseBits(lang, installScriptBits, &tagflags))) { if ((rc = parseBits(lang, installScriptBits, &tagflags))) {
rpmError(RPMERR_BADSPEC, rpmlog(RPMERR_BADSPEC,
_("line %d: Bad %s: qualifiers: %s\n"), _("line %d: Bad %s: qualifiers: %s\n"),
spec->lineNum, rpmTagGetName(tag), spec->line); spec->lineNum, rpmTagGetName(tag), spec->line);
return rc; return rc;
@ -647,7 +647,7 @@ static int handlePreambleTag(rpmSpec spec, Package pkg, rpmTag tag,
if ((rc = poptParseArgvString(field, if ((rc = poptParseArgvString(field,
&(spec->BACount), &(spec->BACount),
&(spec->BANames)))) { &(spec->BANames)))) {
rpmError(RPMERR_BADSPEC, rpmlog(RPMERR_BADSPEC,
_("line %d: Bad BuildArchitecture format: %s\n"), _("line %d: Bad BuildArchitecture format: %s\n"),
spec->lineNum, spec->line); spec->lineNum, spec->line);
return RPMERR_BADSPEC; return RPMERR_BADSPEC;
@ -657,7 +657,7 @@ static int handlePreambleTag(rpmSpec spec, Package pkg, rpmTag tag,
break; break;
default: default:
rpmError(RPMERR_INTERNAL, _("Internal error: Bogus tag %d\n"), tag); rpmlog(RPMERR_INTERNAL, _("Internal error: Bogus tag %d\n"), tag);
return RPMERR_INTERNAL; return RPMERR_INTERNAL;
} }
@ -753,7 +753,7 @@ static int findPreambleTag(rpmSpec spec,rpmTag * tag,
if (!(p->token && !xstrncasecmp(spec->line, p->token, p->len))) if (!(p->token && !xstrncasecmp(spec->line, p->token, p->len)))
continue; continue;
if (p->obsolete) { if (p->obsolete) {
rpmError(RPMERR_BADSPEC, _("Legacy syntax is unsupported: %s\n"), rpmlog(RPMERR_BADSPEC, _("Legacy syntax is unsupported: %s\n"),
p->token); p->token);
p = NULL; p = NULL;
} }
@ -816,13 +816,13 @@ int parsePreamble(rpmSpec spec, int initialPackage)
if (! initialPackage) { if (! initialPackage) {
/* There is one option to %package: <pkg> or -n <pkg> */ /* There is one option to %package: <pkg> or -n <pkg> */
if (parseSimplePart(spec->line, &name, &flag)) { if (parseSimplePart(spec->line, &name, &flag)) {
rpmError(RPMERR_BADSPEC, _("Bad package specification: %s\n"), rpmlog(RPMERR_BADSPEC, _("Bad package specification: %s\n"),
spec->line); spec->line);
return RPMERR_BADSPEC; return RPMERR_BADSPEC;
} }
if (!lookupPackage(spec, name, flag, NULL)) { if (!lookupPackage(spec, name, flag, NULL)) {
rpmError(RPMERR_BADSPEC, _("Package already exists: %s\n"), rpmlog(RPMERR_BADSPEC, _("Package already exists: %s\n"),
spec->line); spec->line);
return RPMERR_BADSPEC; return RPMERR_BADSPEC;
} }
@ -851,7 +851,7 @@ int parsePreamble(rpmSpec spec, int initialPackage)
SKIPSPACE(linep); SKIPSPACE(linep);
if (*linep != '\0') { if (*linep != '\0') {
if (findPreambleTag(spec, &tag, &macro, lang)) { if (findPreambleTag(spec, &tag, &macro, lang)) {
rpmError(RPMERR_BADSPEC, _("line %d: Unknown tag: %s\n"), rpmlog(RPMERR_BADSPEC, _("line %d: Unknown tag: %s\n"),
spec->lineNum, spec->line); spec->lineNum, spec->line);
return RPMERR_BADSPEC; return RPMERR_BADSPEC;
} }
@ -873,7 +873,7 @@ int parsePreamble(rpmSpec spec, int initialPackage)
/* Do some final processing on the header */ /* Do some final processing on the header */
if (!spec->gotBuildRootURL && spec->buildRootURL) { if (!spec->gotBuildRootURL && spec->buildRootURL) {
rpmError(RPMERR_BADSPEC, _("Spec file can't use BuildRoot\n")); rpmlog(RPMERR_BADSPEC, _("Spec file can't use BuildRoot\n"));
return RPMERR_BADSPEC; return RPMERR_BADSPEC;
} }

View File

@ -35,12 +35,12 @@ static int checkOwners(const char * urlfn)
struct stat sb; struct stat sb;
if (Lstat(urlfn, &sb)) { if (Lstat(urlfn, &sb)) {
rpmError(RPMERR_BADSPEC, _("Bad source: %s: %s\n"), rpmlog(RPMERR_BADSPEC, _("Bad source: %s: %s\n"),
urlfn, strerror(errno)); urlfn, strerror(errno));
return RPMERR_BADSPEC; return RPMERR_BADSPEC;
} }
if (!getUname(sb.st_uid) || !getGname(sb.st_gid)) { if (!getUname(sb.st_uid) || !getGname(sb.st_gid)) {
rpmError(RPMERR_BADSPEC, _("Bad owner/group: %s\n"), urlfn); rpmlog(RPMERR_BADSPEC, _("Bad owner/group: %s\n"), urlfn);
return RPMERR_BADSPEC; return RPMERR_BADSPEC;
} }
@ -75,7 +75,7 @@ static char *doPatch(rpmSpec spec, int c, int strip, const char *db,
} }
} }
if (sp == NULL) { if (sp == NULL) {
rpmError(RPMERR_BADSPEC, _("No patch number %d\n"), c); rpmlog(RPMERR_BADSPEC, _("No patch number %d\n"), c);
return NULL; return NULL;
} }
@ -170,7 +170,7 @@ static const char *doUntar(rpmSpec spec, int c, int quietly)
} }
} }
if (sp == NULL) { if (sp == NULL) {
rpmError(RPMERR_BADSPEC, _("No source number %d\n"), c); rpmlog(RPMERR_BADSPEC, _("No source number %d\n"), c);
return NULL; return NULL;
} }
@ -190,7 +190,7 @@ static const char *doUntar(rpmSpec spec, int c, int quietly)
if (Lstat(urlfn, &st) != 0 && errno == ENOENT && if (Lstat(urlfn, &st) != 0 && errno == ENOENT &&
urlIsUrl(sp->fullSource) != URL_IS_UNKNOWN) { urlIsUrl(sp->fullSource) != URL_IS_UNKNOWN) {
if ((rc = urlGetFile(sp->fullSource, urlfn)) != 0) { if ((rc = urlGetFile(sp->fullSource, urlfn)) != 0) {
rpmError(RPMERR_BADFILENAME, rpmlog(RPMERR_BADFILENAME,
_("Couldn't download nosource %s: %s\n"), _("Couldn't download nosource %s: %s\n"),
sp->fullSource, ftpStrerror(rc)); sp->fullSource, ftpStrerror(rc));
return NULL; return NULL;
@ -292,7 +292,7 @@ static int doSetupMacro(rpmSpec spec, char *line)
dirName = NULL; dirName = NULL;
if ((rc = poptParseArgvString(line, &argc, &argv))) { if ((rc = poptParseArgvString(line, &argc, &argv))) {
rpmError(RPMERR_BADSPEC, _("Error parsing %%setup: %s\n"), rpmlog(RPMERR_BADSPEC, _("Error parsing %%setup: %s\n"),
poptStrerror(rc)); poptStrerror(rc));
return RPMERR_BADSPEC; return RPMERR_BADSPEC;
} }
@ -307,7 +307,7 @@ static int doSetupMacro(rpmSpec spec, char *line)
/* We only parse -a and -b here */ /* We only parse -a and -b here */
if (parseNum(optArg, &num)) { if (parseNum(optArg, &num)) {
rpmError(RPMERR_BADSPEC, _("line %d: Bad arg to %%setup: %s\n"), rpmlog(RPMERR_BADSPEC, _("line %d: Bad arg to %%setup: %s\n"),
spec->lineNum, (optArg ? optArg : "???")); spec->lineNum, (optArg ? optArg : "???"));
before = freeStringBuf(before); before = freeStringBuf(before);
after = freeStringBuf(after); after = freeStringBuf(after);
@ -325,7 +325,7 @@ static int doSetupMacro(rpmSpec spec, char *line)
} }
if (arg < -1) { if (arg < -1) {
rpmError(RPMERR_BADSPEC, _("line %d: Bad %%setup option %s: %s\n"), rpmlog(RPMERR_BADSPEC, _("line %d: Bad %%setup option %s: %s\n"),
spec->lineNum, spec->lineNum,
poptBadOption(optCon, POPT_BADOPTION_NOALIAS), poptBadOption(optCon, POPT_BADOPTION_NOALIAS),
poptStrerror(arg)); poptStrerror(arg));
@ -459,7 +459,7 @@ static int doPatchMacro(rpmSpec spec, char *line)
/* orig suffix */ /* orig suffix */
opt_b = strtok(NULL, " \t\n"); opt_b = strtok(NULL, " \t\n");
if (! opt_b) { if (! opt_b) {
rpmError(RPMERR_BADSPEC, rpmlog(RPMERR_BADSPEC,
_("line %d: Need arg to %%patch -b: %s\n"), _("line %d: Need arg to %%patch -b: %s\n"),
spec->lineNum, spec->line); spec->lineNum, spec->line);
return RPMERR_BADSPEC; return RPMERR_BADSPEC;
@ -468,7 +468,7 @@ static int doPatchMacro(rpmSpec spec, char *line)
/* orig suffix */ /* orig suffix */
opt_b = strtok(NULL, " \t\n"); opt_b = strtok(NULL, " \t\n");
if (! opt_b) { if (! opt_b) {
rpmError(RPMERR_BADSPEC, rpmlog(RPMERR_BADSPEC,
_("line %d: Need arg to %%patch -z: %s\n"), _("line %d: Need arg to %%patch -z: %s\n"),
spec->lineNum, spec->line); spec->lineNum, spec->line);
return RPMERR_BADSPEC; return RPMERR_BADSPEC;
@ -485,7 +485,7 @@ static int doPatchMacro(rpmSpec spec, char *line)
} }
opt_F = (fnum ? strtol(fnum, &end, 10) : 0); opt_F = (fnum ? strtol(fnum, &end, 10) : 0);
if (! opt_F || *end) { if (! opt_F || *end) {
rpmError(RPMERR_BADSPEC, rpmlog(RPMERR_BADSPEC,
_("line %d: Bad arg to %%patch -F: %s\n"), _("line %d: Bad arg to %%patch -F: %s\n"),
spec->lineNum, spec->line); spec->lineNum, spec->line);
return RPMERR_BADSPEC; return RPMERR_BADSPEC;
@ -497,14 +497,14 @@ static int doPatchMacro(rpmSpec spec, char *line)
} else { } else {
s = strtok(NULL, " \t\n"); s = strtok(NULL, " \t\n");
if (s == NULL) { if (s == NULL) {
rpmError(RPMERR_BADSPEC, rpmlog(RPMERR_BADSPEC,
_("line %d: Need arg to %%patch -p: %s\n"), _("line %d: Need arg to %%patch -p: %s\n"),
spec->lineNum, spec->line); spec->lineNum, spec->line);
return RPMERR_BADSPEC; return RPMERR_BADSPEC;
} }
} }
if (parseNum(s, &opt_p)) { if (parseNum(s, &opt_p)) {
rpmError(RPMERR_BADSPEC, rpmlog(RPMERR_BADSPEC,
_("line %d: Bad arg to %%patch -p: %s\n"), _("line %d: Bad arg to %%patch -p: %s\n"),
spec->lineNum, spec->line); spec->lineNum, spec->line);
return RPMERR_BADSPEC; return RPMERR_BADSPEC;
@ -512,11 +512,11 @@ static int doPatchMacro(rpmSpec spec, char *line)
} else { } else {
/* Must be a patch num */ /* Must be a patch num */
if (patch_index == 1024) { if (patch_index == 1024) {
rpmError(RPMERR_BADSPEC, _("Too many patches!\n")); rpmlog(RPMERR_BADSPEC, _("Too many patches!\n"));
return RPMERR_BADSPEC; return RPMERR_BADSPEC;
} }
if (parseNum(s, &(patch_nums[patch_index]))) { if (parseNum(s, &(patch_nums[patch_index]))) {
rpmError(RPMERR_BADSPEC, _("line %d: Bad arg to %%patch: %s\n"), rpmlog(RPMERR_BADSPEC, _("line %d: Bad arg to %%patch: %s\n"),
spec->lineNum, spec->line); spec->lineNum, spec->line);
return RPMERR_BADSPEC; return RPMERR_BADSPEC;
} }
@ -550,7 +550,7 @@ int parsePrep(rpmSpec spec)
char **lines, **saveLines; char **lines, **saveLines;
if (spec->prep != NULL) { if (spec->prep != NULL) {
rpmError(RPMERR_BADSPEC, _("line %d: second %%prep\n"), spec->lineNum); rpmlog(RPMERR_BADSPEC, _("line %d: second %%prep\n"), spec->lineNum);
return RPMERR_BADSPEC; return RPMERR_BADSPEC;
} }

View File

@ -96,7 +96,7 @@ int parseRCPOT(rpmSpec spec, Package pkg, const char *field, rpmTag tagN,
/* Tokens must begin with alphanumeric, _, or / */ /* Tokens must begin with alphanumeric, _, or / */
if (!(xisalnum(r[0]) || r[0] == '_' || r[0] == '/')) { if (!(xisalnum(r[0]) || r[0] == '_' || r[0] == '/')) {
rpmError(RPMERR_BADSPEC, rpmlog(RPMERR_BADSPEC,
_("line %d: Dependency tokens must begin with alpha-numeric, '_' or '/': %s\n"), _("line %d: Dependency tokens must begin with alpha-numeric, '_' or '/': %s\n"),
spec->lineNum, spec->line); spec->lineNum, spec->line);
return RPMERR_BADSPEC; return RPMERR_BADSPEC;
@ -124,7 +124,7 @@ int parseRCPOT(rpmSpec spec, Package pkg, const char *field, rpmTag tagN,
continue; continue;
if (r[0] == '/') { if (r[0] == '/') {
rpmError(RPMERR_BADSPEC, rpmlog(RPMERR_BADSPEC,
_("line %d: Versioned file name not permitted: %s\n"), _("line %d: Versioned file name not permitted: %s\n"),
spec->lineNum, spec->line); spec->lineNum, spec->line);
return RPMERR_BADSPEC; return RPMERR_BADSPEC;
@ -155,7 +155,7 @@ int parseRCPOT(rpmSpec spec, Package pkg, const char *field, rpmTag tagN,
if (Flags & RPMSENSE_SENSEMASK) { if (Flags & RPMSENSE_SENSEMASK) {
if (*v == '\0' || ve == v) { if (*v == '\0' || ve == v) {
rpmError(RPMERR_BADSPEC, _("line %d: Version required: %s\n"), rpmlog(RPMERR_BADSPEC, _("line %d: Version required: %s\n"),
spec->lineNum, spec->line); spec->lineNum, spec->line);
return RPMERR_BADSPEC; return RPMERR_BADSPEC;
} }

View File

@ -164,7 +164,7 @@ int parseScript(rpmSpec spec, int parsePart)
/* break line into two */ /* break line into two */
p = strstr(spec->line, "--"); p = strstr(spec->line, "--");
if (!p) { if (!p) {
rpmError(RPMERR_BADSPEC, _("line %d: triggers must have --: %s\n"), rpmlog(RPMERR_BADSPEC, _("line %d: triggers must have --: %s\n"),
spec->lineNum, spec->line); spec->lineNum, spec->line);
return RPMERR_BADSPEC; return RPMERR_BADSPEC;
} }
@ -174,7 +174,7 @@ int parseScript(rpmSpec spec, int parsePart)
} }
if ((rc = poptParseArgvString(spec->line, &argc, &argv))) { if ((rc = poptParseArgvString(spec->line, &argc, &argv))) {
rpmError(RPMERR_BADSPEC, _("line %d: Error parsing %s: %s\n"), rpmlog(RPMERR_BADSPEC, _("line %d: Error parsing %s: %s\n"),
spec->lineNum, partname, poptStrerror(rc)); spec->lineNum, partname, poptStrerror(rc));
return RPMERR_BADSPEC; return RPMERR_BADSPEC;
} }
@ -185,14 +185,14 @@ int parseScript(rpmSpec spec, int parsePart)
case 'p': case 'p':
if (prog[0] == '<') { if (prog[0] == '<') {
if (prog[strlen(prog)-1] != '>') { if (prog[strlen(prog)-1] != '>') {
rpmError(RPMERR_BADSPEC, rpmlog(RPMERR_BADSPEC,
_("line %d: internal script must end " _("line %d: internal script must end "
"with \'>\': %s\n"), spec->lineNum, prog); "with \'>\': %s\n"), spec->lineNum, prog);
rc = RPMERR_BADSPEC; rc = RPMERR_BADSPEC;
goto exit; goto exit;
} }
} else if (prog[0] != '/') { } else if (prog[0] != '/') {
rpmError(RPMERR_BADSPEC, rpmlog(RPMERR_BADSPEC,
_("line %d: script program must begin " _("line %d: script program must begin "
"with \'/\': %s\n"), spec->lineNum, prog); "with \'/\': %s\n"), spec->lineNum, prog);
rc = RPMERR_BADSPEC; rc = RPMERR_BADSPEC;
@ -206,7 +206,7 @@ int parseScript(rpmSpec spec, int parsePart)
} }
if (arg < -1) { if (arg < -1) {
rpmError(RPMERR_BADSPEC, _("line %d: Bad option %s: %s\n"), rpmlog(RPMERR_BADSPEC, _("line %d: Bad option %s: %s\n"),
spec->lineNum, spec->lineNum,
poptBadOption(optCon, POPT_BADOPTION_NOALIAS), poptBadOption(optCon, POPT_BADOPTION_NOALIAS),
spec->line); spec->line);
@ -218,7 +218,7 @@ int parseScript(rpmSpec spec, int parsePart)
if (name == NULL) if (name == NULL)
name = poptGetArg(optCon); name = poptGetArg(optCon);
if (poptPeekArg(optCon)) { if (poptPeekArg(optCon)) {
rpmError(RPMERR_BADSPEC, _("line %d: Too many names: %s\n"), rpmlog(RPMERR_BADSPEC, _("line %d: Too many names: %s\n"),
spec->lineNum, spec->lineNum,
spec->line); spec->line);
rc = RPMERR_BADSPEC; rc = RPMERR_BADSPEC;
@ -227,7 +227,7 @@ int parseScript(rpmSpec spec, int parsePart)
} }
if (lookupPackage(spec, name, flag, &pkg)) { if (lookupPackage(spec, name, flag, &pkg)) {
rpmError(RPMERR_BADSPEC, _("line %d: Package does not exist: %s\n"), rpmlog(RPMERR_BADSPEC, _("line %d: Package does not exist: %s\n"),
spec->lineNum, spec->line); spec->lineNum, spec->line);
rc = RPMERR_BADSPEC; rc = RPMERR_BADSPEC;
goto exit; goto exit;
@ -235,7 +235,7 @@ int parseScript(rpmSpec spec, int parsePart)
if (tag != RPMTAG_TRIGGERSCRIPTS) { if (tag != RPMTAG_TRIGGERSCRIPTS) {
if (headerIsEntry(pkg->header, progtag)) { if (headerIsEntry(pkg->header, progtag)) {
rpmError(RPMERR_BADSPEC, _("line %d: Second %s\n"), rpmlog(RPMERR_BADSPEC, _("line %d: Second %s\n"),
spec->lineNum, partname); spec->lineNum, partname);
rc = RPMERR_BADSPEC; rc = RPMERR_BADSPEC;
goto exit; goto exit;
@ -243,7 +243,7 @@ int parseScript(rpmSpec spec, int parsePart)
} }
if ((rc = poptParseArgvString(prog, &progArgc, &progArgv))) { if ((rc = poptParseArgvString(prog, &progArgc, &progArgv))) {
rpmError(RPMERR_BADSPEC, _("line %d: Error parsing %s: %s\n"), rpmlog(RPMERR_BADSPEC, _("line %d: Error parsing %s: %s\n"),
spec->lineNum, partname, poptStrerror(rc)); spec->lineNum, partname, poptStrerror(rc));
rc = RPMERR_BADSPEC; rc = RPMERR_BADSPEC;
goto exit; goto exit;
@ -280,7 +280,7 @@ int parseScript(rpmSpec spec, int parsePart)
} else } else
#endif #endif
if (progArgv[0][0] == '<') { if (progArgv[0][0] == '<') {
rpmError(RPMERR_BADSPEC, rpmlog(RPMERR_BADSPEC,
_("line %d: unsupported internal script: %s\n"), _("line %d: unsupported internal script: %s\n"),
spec->lineNum, progArgv[0]); spec->lineNum, progArgv[0]);
rc = RPMERR_BADSPEC; rc = RPMERR_BADSPEC;

View File

@ -171,7 +171,7 @@ static int copyNextLine(rpmSpec spec, OFI_t *ofi, int strip)
/* Don't expand macros (eg. %define) in false branch of %if clause */ /* Don't expand macros (eg. %define) in false branch of %if clause */
if (spec->readStack->reading && if (spec->readStack->reading &&
expandMacros(spec, spec->macros, spec->lbuf, sizeof(spec->lbuf))) { expandMacros(spec, spec->macros, spec->lbuf, sizeof(spec->lbuf))) {
rpmError(RPMERR_BADSPEC, _("line %d: %s\n"), rpmlog(RPMERR_BADSPEC, _("line %d: %s\n"),
spec->lineNum, spec->lbuf); spec->lineNum, spec->lbuf);
return RPMERR_BADSPEC; return RPMERR_BADSPEC;
} }
@ -220,7 +220,7 @@ retry:
ofi->fd = Fopen(ofi->fileName, "r.fpio"); ofi->fd = Fopen(ofi->fileName, "r.fpio");
if (ofi->fd == NULL || Ferror(ofi->fd)) { if (ofi->fd == NULL || Ferror(ofi->fd)) {
/* XXX Fstrerror */ /* XXX Fstrerror */
rpmError(RPMERR_BADSPEC, _("Unable to open %s: %s\n"), rpmlog(RPMERR_BADSPEC, _("Unable to open %s: %s\n"),
ofi->fileName, Fstrerror(ofi->fd)); ofi->fileName, Fstrerror(ofi->fd));
return RPMERR_BADSPEC; return RPMERR_BADSPEC;
} }
@ -234,7 +234,7 @@ retry:
if (f == NULL || !fgets(ofi->readBuf, BUFSIZ, f)) { if (f == NULL || !fgets(ofi->readBuf, BUFSIZ, f)) {
/* EOF */ /* EOF */
if (spec->readStack->next) { if (spec->readStack->next) {
rpmError(RPMERR_UNMATCHEDIF, _("Unclosed %%if\n")); rpmlog(RPMERR_UNMATCHEDIF, _("Unclosed %%if\n"));
return RPMERR_UNMATCHEDIF; return RPMERR_UNMATCHEDIF;
} }
@ -310,7 +310,7 @@ retry:
s += 3; s += 3;
match = parseExpressionBoolean(spec, s); match = parseExpressionBoolean(spec, s);
if (match < 0) { if (match < 0) {
rpmError(RPMERR_UNMATCHEDIF, rpmlog(RPMERR_UNMATCHEDIF,
_("%s:%d: parseExpressionBoolean returns %d\n"), _("%s:%d: parseExpressionBoolean returns %d\n"),
ofi->fileName, ofi->lineNum, match); ofi->fileName, ofi->lineNum, match);
return RPMERR_BADSPEC; return RPMERR_BADSPEC;
@ -319,7 +319,7 @@ retry:
s += 5; s += 5;
if (! spec->readStack->next) { if (! spec->readStack->next) {
/* Got an else with no %if ! */ /* Got an else with no %if ! */
rpmError(RPMERR_UNMATCHEDIF, rpmlog(RPMERR_UNMATCHEDIF,
_("%s:%d: Got a %%else with no %%if\n"), _("%s:%d: Got a %%else with no %%if\n"),
ofi->fileName, ofi->lineNum); ofi->fileName, ofi->lineNum);
return RPMERR_UNMATCHEDIF; return RPMERR_UNMATCHEDIF;
@ -331,7 +331,7 @@ retry:
s += 6; s += 6;
if (! spec->readStack->next) { if (! spec->readStack->next) {
/* Got an end with no %if ! */ /* Got an end with no %if ! */
rpmError(RPMERR_UNMATCHEDIF, rpmlog(RPMERR_UNMATCHEDIF,
_("%s:%d: Got a %%endif with no %%if\n"), _("%s:%d: Got a %%endif with no %%if\n"),
ofi->fileName, ofi->lineNum); ofi->fileName, ofi->lineNum);
return RPMERR_UNMATCHEDIF; return RPMERR_UNMATCHEDIF;
@ -346,7 +346,7 @@ retry:
s += 8; s += 8;
fileName = s; fileName = s;
if (! xisspace(*fileName)) { if (! xisspace(*fileName)) {
rpmError(RPMERR_BADSPEC, _("malformed %%include statement\n")); rpmlog(RPMERR_BADSPEC, _("malformed %%include statement\n"));
return RPMERR_BADSPEC; return RPMERR_BADSPEC;
} }
SKIPSPACE(fileName); SKIPSPACE(fileName);
@ -355,7 +355,7 @@ retry:
p = endFileName; p = endFileName;
SKIPSPACE(p); SKIPSPACE(p);
if (*p != '\0') { if (*p != '\0') {
rpmError(RPMERR_BADSPEC, _("malformed %%include statement\n")); rpmlog(RPMERR_BADSPEC, _("malformed %%include statement\n"));
return RPMERR_BADSPEC; return RPMERR_BADSPEC;
} }
*endFileName = '\0'; *endFileName = '\0';
@ -427,7 +427,7 @@ int parseSpec(rpmts ts, const char *specFile, const char *rootURL,
(void) urlPath(buildRootURL, &buildRoot); (void) urlPath(buildRootURL, &buildRoot);
if (*buildRoot == '\0') buildRoot = "/"; if (*buildRoot == '\0') buildRoot = "/";
if (!strcmp(buildRoot, "/")) { if (!strcmp(buildRoot, "/")) {
rpmError(RPMERR_BADSPEC, rpmlog(RPMERR_BADSPEC,
_("BuildRoot can not be \"/\": %s\n"), buildRootURL); _("BuildRoot can not be \"/\": %s\n"), buildRootURL);
return RPMERR_BADSPEC; return RPMERR_BADSPEC;
} }
@ -546,7 +546,7 @@ int parseSpec(rpmts ts, const char *specFile, const char *rootURL,
spec->BACount = index; spec->BACount = index;
if (! index) { if (! index) {
rpmError(RPMERR_BADSPEC, rpmlog(RPMERR_BADSPEC,
_("No compatible architectures found for build\n")); _("No compatible architectures found for build\n"));
spec = freeSpec(spec); spec = freeSpec(spec);
return RPMERR_BADSPEC; return RPMERR_BADSPEC;
@ -604,7 +604,7 @@ int parseSpec(rpmts ts, const char *specFile, const char *rootURL,
if (!headerIsEntry(pkg->header, RPMTAG_DESCRIPTION)) { if (!headerIsEntry(pkg->header, RPMTAG_DESCRIPTION)) {
const char * name; const char * name;
(void) headerNVR(pkg->header, &name, NULL, NULL); (void) headerNVR(pkg->header, &name, NULL, NULL);
rpmError(RPMERR_BADSPEC, _("Package has no %%description: %s\n"), rpmlog(RPMERR_BADSPEC, _("Package has no %%description: %s\n"),
name); name);
spec = freeSpec(spec); spec = freeSpec(spec);
return RPMERR_BADSPEC; return RPMERR_BADSPEC;

View File

@ -94,7 +94,7 @@ static void buildArgCallback( poptContext con,
case POPT_RMBUILD: rba->buildAmount |= RPMBUILD_RMBUILD; break; case POPT_RMBUILD: rba->buildAmount |= RPMBUILD_RMBUILD; break;
case POPT_BUILDROOT: case POPT_BUILDROOT:
if (rba->buildRootOverride) { if (rba->buildRootOverride) {
rpmError(RPMERR_BUILDROOT, _("buildroot already specified, ignoring %s\n"), arg); rpmlog(RPMERR_BUILDROOT, _("buildroot already specified, ignoring %s\n"), arg);
break; break;
} }
rba->buildRootOverride = xstrdup(arg); rba->buildRootOverride = xstrdup(arg);

View File

@ -119,12 +119,12 @@ static StringBuf getOutputFrom(const char * dir, ARGV_t argv,
unsetenv("MALLOC_CHECK_"); unsetenv("MALLOC_CHECK_");
(void) execvp(argv[0], (char *const *)argv); (void) execvp(argv[0], (char *const *)argv);
/* XXX this error message is probably not seen. */ /* XXX this error message is probably not seen. */
rpmError(RPMERR_EXEC, _("Couldn't exec %s: %s\n"), rpmlog(RPMERR_EXEC, _("Couldn't exec %s: %s\n"),
argv[0], strerror(errno)); argv[0], strerror(errno));
_exit(RPMERR_EXEC); _exit(RPMERR_EXEC);
} }
if (child < 0) { if (child < 0) {
rpmError(RPMERR_FORK, _("Couldn't fork %s: %s\n"), rpmlog(RPMERR_FORK, _("Couldn't fork %s: %s\n"),
argv[0], strerror(errno)); argv[0], strerror(errno));
return NULL; return NULL;
} }
@ -210,11 +210,11 @@ top:
(unsigned)child, (unsigned)reaped, status); (unsigned)child, (unsigned)reaped, status);
if (failNonZero && (!WIFEXITED(status) || WEXITSTATUS(status))) { if (failNonZero && (!WIFEXITED(status) || WEXITSTATUS(status))) {
rpmError(RPMERR_EXEC, _("%s failed\n"), argv[0]); rpmlog(RPMERR_EXEC, _("%s failed\n"), argv[0]);
return NULL; return NULL;
} }
if (writeBytesLeft) { if (writeBytesLeft) {
rpmError(RPMERR_EXEC, _("failed to write all data to %s\n"), argv[0]); rpmlog(RPMERR_EXEC, _("failed to write all data to %s\n"), argv[0]);
return NULL; return NULL;
} }
return readBuff; return readBuff;
@ -1233,7 +1233,7 @@ int rpmfcClassify(rpmfc fc, ARGV_t argv, int_16 * fmode)
ms = magic_open(msflags); ms = magic_open(msflags);
if (ms == NULL) { if (ms == NULL) {
xx = RPMERR_EXEC; xx = RPMERR_EXEC;
rpmError(xx, _("magic_open(0x%x) failed: %s\n"), rpmlog(xx, _("magic_open(0x%x) failed: %s\n"),
msflags, strerror(errno)); msflags, strerror(errno));
assert(ms != NULL); /* XXX figger a proper return path. */ assert(ms != NULL); /* XXX figger a proper return path. */
} }
@ -1241,7 +1241,7 @@ assert(ms != NULL); /* XXX figger a proper return path. */
xx = magic_load(ms, NULL); xx = magic_load(ms, NULL);
if (xx == -1) { if (xx == -1) {
xx = RPMERR_EXEC; xx = RPMERR_EXEC;
rpmError(xx, _("magic_load failed: %s\n"), magic_error(ms)); rpmlog(xx, _("magic_load failed: %s\n"), magic_error(ms));
assert(xx != -1); /* XXX figger a proper return path. */ assert(xx != -1); /* XXX figger a proper return path. */
} }
@ -1285,7 +1285,7 @@ assert(s != NULL);
if (ftype == NULL) { if (ftype == NULL) {
xx = RPMERR_EXEC; xx = RPMERR_EXEC;
rpmError(xx, _("magic_file(ms, \"%s\") failed: mode %06o %s\n"), rpmlog(xx, _("magic_file(ms, \"%s\") failed: mode %06o %s\n"),
s, mode, magic_error(ms)); s, mode, magic_error(ms));
assert(ftype != NULL); /* XXX figger a proper return path. */ assert(ftype != NULL); /* XXX figger a proper return path. */
} }
@ -1499,7 +1499,7 @@ static int rpmfcGenerateDependsHelper(const rpmSpec spec, Package pkg, rpmfi fi)
if (sb_stdout == NULL) { if (sb_stdout == NULL) {
rc = RPMERR_EXEC; rc = RPMERR_EXEC;
rpmError(rc, _("Failed to find %s:\n"), dm->msg); rpmlog(rc, _("Failed to find %s:\n"), dm->msg);
break; break;
} }
@ -1508,7 +1508,7 @@ static int rpmfcGenerateDependsHelper(const rpmSpec spec, Package pkg, rpmfi fi)
sb_stdout = freeStringBuf(sb_stdout); sb_stdout = freeStringBuf(sb_stdout);
if (rc) { if (rc) {
rpmError(rc, _("Failed to find %s:\n"), dm->msg); rpmlog(rc, _("Failed to find %s:\n"), dm->msg);
break; break;
} }
} }

View File

@ -221,13 +221,13 @@ int parseNoSource(rpmSpec spec, const char * field, int tag)
if (*fe != '\0') fe++; if (*fe != '\0') fe++;
if (parseNum(f, &num)) { if (parseNum(f, &num)) {
rpmError(RPMERR_BADSPEC, _("line %d: Bad number: %s\n"), rpmlog(RPMERR_BADSPEC, _("line %d: Bad number: %s\n"),
spec->lineNum, f); spec->lineNum, f);
return RPMERR_BADSPEC; return RPMERR_BADSPEC;
} }
if (! (p = findSource(spec, num, flag))) { if (! (p = findSource(spec, num, flag))) {
rpmError(RPMERR_BADSPEC, _("line %d: Bad no%s number: %d\n"), rpmlog(RPMERR_BADSPEC, _("line %d: Bad no%s number: %d\n"),
spec->lineNum, name, num); spec->lineNum, name, num);
return RPMERR_BADSPEC; return RPMERR_BADSPEC;
} }
@ -286,7 +286,7 @@ int addSource(rpmSpec spec, Package pkg, const char *field, int tag)
num = 0; num = 0;
} else { } else {
if (parseNum(buf, &num)) { if (parseNum(buf, &num)) {
rpmError(RPMERR_BADSPEC, _("line %d: Bad %s number: %s\n"), rpmlog(RPMERR_BADSPEC, _("line %d: Bad %s number: %s\n"),
spec->lineNum, name, spec->line); spec->lineNum, name, spec->line);
return RPMERR_BADSPEC; return RPMERR_BADSPEC;
} }
@ -587,7 +587,7 @@ printNewSpecfile(rpmSpec spec)
/* XXX this should use queryHeader(), but prints out tn as well. */ /* XXX this should use queryHeader(), but prints out tn as well. */
msgstr = headerSprintf(h, fmt, rpmTagTable, rpmHeaderFormats, &errstr); msgstr = headerSprintf(h, fmt, rpmTagTable, rpmHeaderFormats, &errstr);
if (msgstr == NULL) { if (msgstr == NULL) {
rpmError(RPMERR_QFMT, _("can't query %s: %s\n"), tn, errstr); rpmlog(RPMERR_QFMT, _("can't query %s: %s\n"), tn, errstr);
return; return;
} }
@ -652,7 +652,7 @@ int rpmspecQuery(rpmts ts, QVA_t qva, const char * arg)
cookie, anyarch, force) cookie, anyarch, force)
|| (spec = rpmtsSetSpec(ts, NULL)) == NULL) || (spec = rpmtsSetSpec(ts, NULL)) == NULL)
{ {
rpmError(RPMERR_QUERY, rpmlog(RPMERR_QUERY,
_("query of specfile %s failed, can't parse\n"), arg); _("query of specfile %s failed, can't parse\n"), arg);
goto exit; goto exit;
} }

View File

@ -62,7 +62,7 @@ static int getFilesystemList(void)
num = mntctl(MCTL_QUERY, sizeof(size), (char *) &size); num = mntctl(MCTL_QUERY, sizeof(size), (char *) &size);
if (num < 0) { if (num < 0) {
rpmError(RPMERR_MTAB, _("mntctl() failed to return size: %s\n"), rpmlog(RPMERR_MTAB, _("mntctl() failed to return size: %s\n"),
strerror(errno)); strerror(errno));
return 1; return 1;
} }
@ -77,7 +77,7 @@ static int getFilesystemList(void)
buf = alloca(size); buf = alloca(size);
num = mntctl(MCTL_QUERY, size, buf); num = mntctl(MCTL_QUERY, size, buf);
if ( num <= 0 ) { if ( num <= 0 ) {
rpmError(RPMERR_MTAB, _("mntctl() failed to return mount points: %s\n"), rpmlog(RPMERR_MTAB, _("mntctl() failed to return mount points: %s\n"),
strerror(errno)); strerror(errno));
return 1; return 1;
} }
@ -102,7 +102,7 @@ static int getFilesystemList(void)
case ESTALE: case ESTALE:
continue; continue;
default: default:
rpmError(RPMERR_STAT, _("failed to stat %s: %s\n"), fsnames[i], rpmlog(RPMERR_STAT, _("failed to stat %s: %s\n"), fsnames[i],
strerror(errno)); strerror(errno));
rpmFreeFilesystems(); rpmFreeFilesystems();
@ -144,7 +144,7 @@ static int getFilesystemList(void)
mtab = fopen(MOUNTED, "r"); mtab = fopen(MOUNTED, "r");
if (!mtab) { if (!mtab) {
rpmError(RPMERR_MTAB, _("failed to open %s: %s\n"), MOUNTED, rpmlog(RPMERR_MTAB, _("failed to open %s: %s\n"), MOUNTED,
strerror(errno)); strerror(errno));
return 1; return 1;
} }
@ -194,7 +194,7 @@ static int getFilesystemList(void)
# endif # endif
if (stat(mntdir, &sb)) { if (stat(mntdir, &sb)) {
rpmError(RPMERR_STAT, _("failed to stat %s: %s\n"), mntdir, rpmlog(RPMERR_STAT, _("failed to stat %s: %s\n"), mntdir,
strerror(errno)); strerror(errno));
rpmFreeFilesystems(); rpmFreeFilesystems();
@ -305,7 +305,7 @@ int rpmGetFilesystemUsage(const char ** fileList, int_32 * fssizes, int numFiles
chptr = dirName + strlen(dirName) - 1; chptr = dirName + strlen(dirName) - 1;
while (stat(dirName, &sb)) { while (stat(dirName, &sb)) {
if (errno != ENOENT) { if (errno != ENOENT) {
rpmError(RPMERR_STAT, _("failed to stat %s: %s\n"), buf, rpmlog(RPMERR_STAT, _("failed to stat %s: %s\n"), buf,
strerror(errno)); strerror(errno));
sourceDir = _free(sourceDir); sourceDir = _free(sourceDir);
usages = _free(usages); usages = _free(usages);
@ -327,7 +327,7 @@ int rpmGetFilesystemUsage(const char ** fileList, int_32 * fssizes, int numFiles
break; break;
if (j == numFilesystems) { if (j == numFilesystems) {
rpmError(RPMERR_BADDEV, rpmlog(RPMERR_BADDEV,
_("file %s is on an unknown device\n"), buf); _("file %s is on an unknown device\n"), buf);
sourceDir = _free(sourceDir); sourceDir = _free(sourceDir);
usages = _free(usages); usages = _free(usages);

View File

@ -1738,13 +1738,13 @@ if (!(fsm->mapFlags & CPIO_ALL_HARDLINKS)) break;
break; break;
/* XXX common error message. */ /* XXX common error message. */
rpmError( rpmlog(
(strict_erasures ? RPMERR_RMDIR : RPMDEBUG_RMDIR), (strict_erasures ? RPMERR_RMDIR : RPMDEBUG_RMDIR),
_("%s rmdir of %s failed: Directory not empty\n"), _("%s rmdir of %s failed: Directory not empty\n"),
rpmfiTypeString(fi), fsm->path); rpmfiTypeString(fi), fsm->path);
break; break;
default: default:
rpmError( rpmlog(
(strict_erasures ? RPMERR_RMDIR : RPMDEBUG_RMDIR), (strict_erasures ? RPMERR_RMDIR : RPMDEBUG_RMDIR),
_("%s rmdir of %s failed: %s\n"), _("%s rmdir of %s failed: %s\n"),
rpmfiTypeString(fi), fsm->path, strerror(errno)); rpmfiTypeString(fi), fsm->path, strerror(errno));
@ -1758,7 +1758,7 @@ if (!(fsm->mapFlags & CPIO_ALL_HARDLINKS)) break;
if (fsm->fflags & RPMFILE_MISSINGOK) if (fsm->fflags & RPMFILE_MISSINGOK)
break; break;
default: default:
rpmError( rpmlog(
(strict_erasures ? RPMERR_UNLINK : RPMDEBUG_UNLINK), (strict_erasures ? RPMERR_UNLINK : RPMDEBUG_UNLINK),
_("%s unlink of %s failed: %s\n"), _("%s unlink of %s failed: %s\n"),
rpmfiTypeString(fi), fsm->path, strerror(errno)); rpmfiTypeString(fi), fsm->path, strerror(errno));

View File

@ -130,7 +130,7 @@ IDTX IDTXglob(rpmts ts, const char * globstr, rpmTag tag)
fd = Fopen(av[i], "r.ufdio"); fd = Fopen(av[i], "r.ufdio");
if (fd == NULL || Ferror(fd)) { if (fd == NULL || Ferror(fd)) {
rpmError(RPMERR_OPEN, _("open of %s failed: %s\n"), av[i], rpmlog(RPMERR_OPEN, _("open of %s failed: %s\n"), av[i],
Fstrerror(fd)); Fstrerror(fd));
if (fd != NULL) (void) Fclose(fd); if (fd != NULL) (void) Fclose(fd);
continue; continue;

View File

@ -37,12 +37,12 @@ rpmRC rpmMkdirPath (const char * dpath, const char * dname)
break; break;
} }
if (rc < 0) { if (rc < 0) {
rpmError(RPMERR_CREATE, _("cannot create %%%s %s\n"), dname, dpath); rpmlog(RPMERR_CREATE, _("cannot create %%%s %s\n"), dname, dpath);
return RPMRC_FAIL; return RPMRC_FAIL;
} }
} }
if ((rc = Access(dpath, W_OK))) { if ((rc = Access(dpath, W_OK))) {
rpmError(RPMERR_CREATE, _("cannot write to %%%s %s\n"), dname, dpath); rpmlog(RPMERR_CREATE, _("cannot write to %%%s %s\n"), dname, dpath);
return RPMRC_FAIL; return RPMRC_FAIL;
} }
return RPMRC_OK; return RPMRC_OK;
@ -178,18 +178,18 @@ int makeTempFile(const char * prefix, const char ** fnptr, FD_t * fdptr)
case URL_IS_UNKNOWN: case URL_IS_UNKNOWN:
{ struct stat sb, sb2; { struct stat sb, sb2;
if (!stat(tfn, &sb) && S_ISLNK(sb.st_mode)) { if (!stat(tfn, &sb) && S_ISLNK(sb.st_mode)) {
rpmError(RPMERR_SCRIPT, _("error creating temporary file %s\n"), tfn); rpmlog(RPMERR_SCRIPT, _("error creating temporary file %s\n"), tfn);
goto errxit; goto errxit;
} }
if (sb.st_nlink != 1) { if (sb.st_nlink != 1) {
rpmError(RPMERR_SCRIPT, _("error creating temporary file %s\n"), tfn); rpmlog(RPMERR_SCRIPT, _("error creating temporary file %s\n"), tfn);
goto errxit; goto errxit;
} }
if (fstat(Fileno(fd), &sb2) == 0) { if (fstat(Fileno(fd), &sb2) == 0) {
if (sb2.st_ino != sb.st_ino || sb2.st_dev != sb.st_dev) { if (sb2.st_ino != sb.st_ino || sb2.st_dev != sb.st_dev) {
rpmError(RPMERR_SCRIPT, _("error creating temporary file %s\n"), tfn); rpmlog(RPMERR_SCRIPT, _("error creating temporary file %s\n"), tfn);
goto errxit; goto errxit;
} }
} }

View File

@ -712,7 +712,7 @@ rpmRC rpmReadPackageFile(rpmts ts, FD_t fd, const char * fn, Header * hdrp)
switch (l->major) { switch (l->major) {
case 1: case 1:
rpmError(RPMERR_NEWPACKAGE, rpmlog(RPMERR_NEWPACKAGE,
_("packaging version 1 is not supported by this version of RPM\n")); _("packaging version 1 is not supported by this version of RPM\n"));
rc = RPMRC_NOTFOUND; rc = RPMRC_NOTFOUND;
goto exit; goto exit;
@ -722,7 +722,7 @@ rpmRC rpmReadPackageFile(rpmts ts, FD_t fd, const char * fn, Header * hdrp)
case 4: case 4:
break; break;
default: default:
rpmError(RPMERR_NEWPACKAGE, _("only packaging with major numbers <= 4 " rpmlog(RPMERR_NEWPACKAGE, _("only packaging with major numbers <= 4 "
"is supported by this version of RPM\n")); "is supported by this version of RPM\n"));
rc = RPMRC_NOTFOUND; rc = RPMRC_NOTFOUND;
goto exit; goto exit;
@ -734,14 +734,14 @@ rpmRC rpmReadPackageFile(rpmts ts, FD_t fd, const char * fn, Header * hdrp)
rc = rpmReadSignature(fd, &sigh, l->signature_type, &msg); rc = rpmReadSignature(fd, &sigh, l->signature_type, &msg);
switch (rc) { switch (rc) {
default: default:
rpmError(RPMERR_SIGGEN, _("%s: rpmReadSignature failed: %s"), fn, rpmlog(RPMERR_SIGGEN, _("%s: rpmReadSignature failed: %s"), fn,
(msg && *msg ? msg : "\n")); (msg && *msg ? msg : "\n"));
msg = _free(msg); msg = _free(msg);
goto exit; goto exit;
break; break;
case RPMRC_OK: case RPMRC_OK:
if (sigh == NULL) { if (sigh == NULL) {
rpmError(RPMERR_SIGGEN, _("%s: No signature available\n"), fn); rpmlog(RPMERR_SIGGEN, _("%s: No signature available\n"), fn);
rc = RPMRC_FAIL; rc = RPMRC_FAIL;
goto exit; goto exit;
} }
@ -806,7 +806,7 @@ rpmRC rpmReadPackageFile(rpmts ts, FD_t fd, const char * fn, Header * hdrp)
(void) rpmswExit(rpmtsOp(ts, opx), nb); (void) rpmswExit(rpmtsOp(ts, opx), nb);
if (rc != RPMRC_OK || h == NULL) { if (rc != RPMRC_OK || h == NULL) {
rpmError(RPMERR_FREAD, _("%s: headerRead failed: %s"), fn, rpmlog(RPMERR_FREAD, _("%s: headerRead failed: %s"), fn,
(msg && *msg ? msg : "\n")); (msg && *msg ? msg : "\n"));
msg = _free(msg); msg = _free(msg);
goto exit; goto exit;
@ -912,7 +912,7 @@ rpmRC rpmReadPackageFile(rpmts ts, FD_t fd, const char * fn, Header * hdrp)
rpmtsOp(ts, RPMTS_OP_DIGEST)->count--; /* XXX one too many */ rpmtsOp(ts, RPMTS_OP_DIGEST)->count--; /* XXX one too many */
dig->nbytes += nb; /* XXX include size of header blob. */ dig->nbytes += nb; /* XXX include size of header blob. */
if (count < 0) { if (count < 0) {
rpmError(RPMERR_FREAD, _("%s: Fread failed: %s\n"), rpmlog(RPMERR_FREAD, _("%s: Fread failed: %s\n"),
fn, Fstrerror(fd)); fn, Fstrerror(fd));
rc = RPMRC_FAIL; rc = RPMRC_FAIL;
goto exit; goto exit;

View File

@ -246,7 +246,7 @@ rpmRC rpmInstallSourcePackage(rpmts ts, FD_t fd,
isSource = headerIsEntry(h, RPMTAG_SOURCEPACKAGE); isSource = headerIsEntry(h, RPMTAG_SOURCEPACKAGE);
if (!isSource) { if (!isSource) {
rpmError(RPMERR_NOTSRPM, _("source package expected, binary found\n")); rpmlog(RPMERR_NOTSRPM, _("source package expected, binary found\n"));
rpmrc = RPMRC_FAIL; rpmrc = RPMRC_FAIL;
goto exit; goto exit;
} }
@ -357,7 +357,7 @@ fi->fmd5s = hfd(fi->fmd5s, -1);
(void) stpcpy( stpcpy( stpcpy(t, _specdir), "/"), fi->bnl[i]); (void) stpcpy( stpcpy( stpcpy(t, _specdir), "/"), fi->bnl[i]);
specFile = t; specFile = t;
} else { } else {
rpmError(RPMERR_NOSPEC, _("source package contains no .spec file\n")); rpmlog(RPMERR_NOSPEC, _("source package contains no .spec file\n"));
rpmrc = RPMRC_FAIL; rpmrc = RPMRC_FAIL;
goto exit; goto exit;
} }
@ -836,7 +836,7 @@ static rpmRC runScript(rpmpsm psm, Header h, const char * sln,
} }
if (psm->sq.child == (pid_t)-1) { if (psm->sq.child == (pid_t)-1) {
rpmError(RPMERR_FORK, _("Couldn't fork %s: %s\n"), sln, strerror(errno)); rpmlog(RPMERR_FORK, _("Couldn't fork %s: %s\n"), sln, strerror(errno));
rc = RPMRC_FAIL; rc = RPMRC_FAIL;
goto exit; goto exit;
} }
@ -846,18 +846,18 @@ static rpmRC runScript(rpmpsm psm, Header h, const char * sln,
/* XXX filter order dependent multilib "other" arch helper error. */ /* XXX filter order dependent multilib "other" arch helper error. */
if (!(psm->sq.reaped >= 0 && !strcmp(argv[0], "/usr/sbin/glibc_post_upgrade") && WEXITSTATUS(psm->sq.status) == 110)) { if (!(psm->sq.reaped >= 0 && !strcmp(argv[0], "/usr/sbin/glibc_post_upgrade") && WEXITSTATUS(psm->sq.status) == 110)) {
if (psm->sq.reaped < 0) { if (psm->sq.reaped < 0) {
rpmError(RPMERR_SCRIPT, rpmlog(RPMERR_SCRIPT,
_("%s(%s-%s-%s.%s) scriptlet failed, waitpid(%d) rc %d: %s\n"), _("%s(%s-%s-%s.%s) scriptlet failed, waitpid(%d) rc %d: %s\n"),
sln, n, v, r, a, psm->sq.child, psm->sq.reaped, strerror(errno)); sln, n, v, r, a, psm->sq.child, psm->sq.reaped, strerror(errno));
rc = RPMRC_FAIL; rc = RPMRC_FAIL;
} else } else
if (!WIFEXITED(psm->sq.status) || WEXITSTATUS(psm->sq.status)) { if (!WIFEXITED(psm->sq.status) || WEXITSTATUS(psm->sq.status)) {
if (WIFSIGNALED(psm->sq.status)) { if (WIFSIGNALED(psm->sq.status)) {
rpmError(RPMERR_SCRIPT, rpmlog(RPMERR_SCRIPT,
_("%s(%s-%s-%s.%s) scriptlet failed, signal %d\n"), _("%s(%s-%s-%s.%s) scriptlet failed, signal %d\n"),
sln, n, v, r, a, WTERMSIG(psm->sq.status)); sln, n, v, r, a, WTERMSIG(psm->sq.status));
} else { } else {
rpmError(RPMERR_SCRIPT, rpmlog(RPMERR_SCRIPT,
_("%s(%s-%s-%s.%s) scriptlet failed, exit status %d\n"), _("%s(%s-%s-%s.%s) scriptlet failed, exit status %d\n"),
sln, n, v, r, a, WEXITSTATUS(psm->sq.status)); sln, n, v, r, a, WEXITSTATUS(psm->sq.status));
} }
@ -1428,7 +1428,7 @@ assert(psm->mi == NULL);
if (!(rpmtsFlags(ts) & RPMTRANS_FLAG_NOPRE)) { if (!(rpmtsFlags(ts) & RPMTRANS_FLAG_NOPRE)) {
rc = rpmpsmNext(psm, PSM_SCRIPT); rc = rpmpsmNext(psm, PSM_SCRIPT);
if (rc != RPMRC_OK) { if (rc != RPMRC_OK) {
rpmError(RPMERR_SCRIPT, rpmlog(RPMERR_SCRIPT,
_("%s: %s scriptlet failed (%d), skipping %s\n"), _("%s: %s scriptlet failed (%d), skipping %s\n"),
psm->stepName, tag2sln(psm->scriptTag), rc, psm->stepName, tag2sln(psm->scriptTag), rc,
rpmteNEVR(psm->te)); rpmteNEVR(psm->te));
@ -1523,7 +1523,7 @@ assert(psm->mi == NULL);
rc = writeLead(psm->fd, &lead); rc = writeLead(psm->fd, &lead);
if (rc != RPMRC_OK) { if (rc != RPMRC_OK) {
rpmError(RPMERR_NOSPACE, _("Unable to write package: %s\n"), rpmlog(RPMERR_NOSPACE, _("Unable to write package: %s\n"),
Fstrerror(psm->fd)); Fstrerror(psm->fd));
break; break;
} }
@ -1535,7 +1535,7 @@ assert(psm->mi == NULL);
/* Reallocate the signature into one contiguous region. */ /* Reallocate the signature into one contiguous region. */
sigh = headerReload(sigh, RPMTAG_HEADERSIGNATURES); sigh = headerReload(sigh, RPMTAG_HEADERSIGNATURES);
if (sigh == NULL) { if (sigh == NULL) {
rpmError(RPMERR_NOSPACE, _("Unable to reload signature header\n")); rpmlog(RPMERR_NOSPACE, _("Unable to reload signature header\n"));
rc = RPMRC_FAIL; rc = RPMRC_FAIL;
break; break;
} }
@ -1609,7 +1609,7 @@ assert(psm->mi == NULL);
xx = rpmpsmNext(psm, PSM_NOTIFY); xx = rpmpsmNext(psm, PSM_NOTIFY);
if (rc) { if (rc) {
rpmError(RPMERR_CPIO, rpmlog(RPMERR_CPIO,
_("unpacking of archive failed%s%s: %s\n"), _("unpacking of archive failed%s%s: %s\n"),
(psm->failedFile != NULL ? _(" on file ") : ""), (psm->failedFile != NULL ? _(" on file ") : ""),
(psm->failedFile != NULL ? psm->failedFile : ""), (psm->failedFile != NULL ? psm->failedFile : ""),
@ -1798,11 +1798,11 @@ assert(psm->mi == NULL);
if (rc) { if (rc) {
if (psm->failedFile) if (psm->failedFile)
rpmError(RPMERR_CPIO, rpmlog(RPMERR_CPIO,
_("%s failed on file %s: %s\n"), _("%s failed on file %s: %s\n"),
psm->stepName, psm->failedFile, cpioStrerror(rc)); psm->stepName, psm->failedFile, cpioStrerror(rc));
else else
rpmError(RPMERR_CPIO, _("%s failed: %s\n"), rpmlog(RPMERR_CPIO, _("%s failed: %s\n"),
psm->stepName, cpioStrerror(rc)); psm->stepName, cpioStrerror(rc));
/* XXX notify callback on error. */ /* XXX notify callback on error. */

View File

@ -111,7 +111,7 @@ static inline const char * queryHeader(Header h, const char * qfmt)
str = headerSprintf(h, qfmt, rpmTagTable, rpmHeaderFormats, &errstr); str = headerSprintf(h, qfmt, rpmTagTable, rpmHeaderFormats, &errstr);
if (str == NULL) if (str == NULL)
rpmError(RPMERR_QFMT, _("incorrect format: %s\n"), errstr); rpmlog(RPMERR_QFMT, _("incorrect format: %s\n"), errstr);
return str; return str;
} }
@ -274,7 +274,7 @@ int showQueryPackage(QVA_t qva, rpmts ts, Header h)
sprintf(te, "%s %s", fuser, fgroup); sprintf(te, "%s %s", fuser, fgroup);
te += strlen(te); te += strlen(te);
} else { } else {
rpmError(RPMERR_INTERNAL, rpmlog(RPMERR_INTERNAL,
_("package has not file owner/group lists\n")); _("package has not file owner/group lists\n"));
} }
@ -303,7 +303,7 @@ int showQueryPackage(QVA_t qva, rpmts ts, Header h)
fuser, fgroup, flink); fuser, fgroup, flink);
te += strlen(te); te += strlen(te);
} else { } else {
rpmError(RPMERR_INTERNAL, rpmlog(RPMERR_INTERNAL,
_("package has neither file owner or id lists\n")); _("package has neither file owner or id lists\n"));
} }
} }
@ -453,7 +453,7 @@ int rpmQueryVerify(QVA_t qva, rpmts ts, const char * arg)
case RPMQV_GROUP: case RPMQV_GROUP:
qva->qva_mi = rpmtsInitIterator(ts, RPMTAG_GROUP, arg, 0); qva->qva_mi = rpmtsInitIterator(ts, RPMTAG_GROUP, arg, 0);
if (qva->qva_mi == NULL) { if (qva->qva_mi == NULL) {
rpmError(RPMERR_QUERYINFO, rpmlog(RPMERR_QUERYINFO,
_("group %s does not contain any packages\n"), arg); _("group %s does not contain any packages\n"), arg);
res = 1; res = 1;
} else } else
@ -463,7 +463,7 @@ int rpmQueryVerify(QVA_t qva, rpmts ts, const char * arg)
case RPMQV_TRIGGEREDBY: case RPMQV_TRIGGEREDBY:
qva->qva_mi = rpmtsInitIterator(ts, RPMTAG_TRIGGERNAME, arg, 0); qva->qva_mi = rpmtsInitIterator(ts, RPMTAG_TRIGGERNAME, arg, 0);
if (qva->qva_mi == NULL) { if (qva->qva_mi == NULL) {
rpmError(RPMERR_QUERYINFO, _("no package triggers %s\n"), arg); rpmlog(RPMERR_QUERYINFO, _("no package triggers %s\n"), arg);
res = 1; res = 1;
} else } else
res = rpmcliShowMatches(qva, ts); res = rpmcliShowMatches(qva, ts);
@ -476,7 +476,7 @@ int rpmQueryVerify(QVA_t qva, rpmts ts, const char * arg)
for (i = 0, s = arg; *s && isxdigit(*s); s++, i++) for (i = 0, s = arg; *s && isxdigit(*s); s++, i++)
{}; {};
if (i != 32) { if (i != 32) {
rpmError(RPMERR_QUERYINFO, _("malformed %s: %s\n"), "pkgid", arg); rpmlog(RPMERR_QUERYINFO, _("malformed %s: %s\n"), "pkgid", arg);
return 1; return 1;
} }
@ -486,7 +486,7 @@ int rpmQueryVerify(QVA_t qva, rpmts ts, const char * arg)
qva->qva_mi = rpmtsInitIterator(ts, RPMTAG_SIGMD5, MD5, sizeof(MD5)); qva->qva_mi = rpmtsInitIterator(ts, RPMTAG_SIGMD5, MD5, sizeof(MD5));
if (qva->qva_mi == NULL) { if (qva->qva_mi == NULL) {
rpmError(RPMERR_QUERYINFO, _("no package matches %s: %s\n"), rpmlog(RPMERR_QUERYINFO, _("no package matches %s: %s\n"),
"pkgid", arg); "pkgid", arg);
res = 1; res = 1;
} else } else
@ -497,13 +497,13 @@ int rpmQueryVerify(QVA_t qva, rpmts ts, const char * arg)
for (i = 0, s = arg; *s && isxdigit(*s); s++, i++) for (i = 0, s = arg; *s && isxdigit(*s); s++, i++)
{}; {};
if (i != 40) { if (i != 40) {
rpmError(RPMERR_QUERYINFO, _("malformed %s: %s\n"), "hdrid", arg); rpmlog(RPMERR_QUERYINFO, _("malformed %s: %s\n"), "hdrid", arg);
return 1; return 1;
} }
qva->qva_mi = rpmtsInitIterator(ts, RPMTAG_SHA1HEADER, arg, 0); qva->qva_mi = rpmtsInitIterator(ts, RPMTAG_SHA1HEADER, arg, 0);
if (qva->qva_mi == NULL) { if (qva->qva_mi == NULL) {
rpmError(RPMERR_QUERYINFO, _("no package matches %s: %s\n"), rpmlog(RPMERR_QUERYINFO, _("no package matches %s: %s\n"),
"hdrid", arg); "hdrid", arg);
res = 1; res = 1;
} else } else
@ -517,7 +517,7 @@ int rpmQueryVerify(QVA_t qva, rpmts ts, const char * arg)
for (i = 0, s = arg; *s && isxdigit(*s); s++, i++) for (i = 0, s = arg; *s && isxdigit(*s); s++, i++)
{}; {};
if (i != 32) { if (i != 32) {
rpmError(RPMERR_QUERY, _("malformed %s: %s\n"), "fileid", arg); rpmlog(RPMERR_QUERY, _("malformed %s: %s\n"), "fileid", arg);
return 1; return 1;
} }
@ -527,7 +527,7 @@ int rpmQueryVerify(QVA_t qva, rpmts ts, const char * arg)
qva->qva_mi = rpmtsInitIterator(ts, RPMTAG_FILEMD5S, MD5, sizeof(MD5)); qva->qva_mi = rpmtsInitIterator(ts, RPMTAG_FILEMD5S, MD5, sizeof(MD5));
if (qva->qva_mi == NULL) { if (qva->qva_mi == NULL) {
rpmError(RPMERR_QUERYINFO, _("no package matches %s: %s\n"), rpmlog(RPMERR_QUERYINFO, _("no package matches %s: %s\n"),
"fileid", arg); "fileid", arg);
res = 1; res = 1;
} else } else
@ -551,12 +551,12 @@ int rpmQueryVerify(QVA_t qva, rpmts ts, const char * arg)
} }
iid = strtoul(myarg, &end, mybase); iid = strtoul(myarg, &end, mybase);
if ((*end) || (end == arg) || (iid == ULONG_MAX)) { if ((*end) || (end == arg) || (iid == ULONG_MAX)) {
rpmError(RPMERR_QUERY, _("malformed %s: %s\n"), "tid", arg); rpmlog(RPMERR_QUERY, _("malformed %s: %s\n"), "tid", arg);
return 1; return 1;
} }
qva->qva_mi = rpmtsInitIterator(ts, RPMTAG_INSTALLTID, &iid, sizeof(iid)); qva->qva_mi = rpmtsInitIterator(ts, RPMTAG_INSTALLTID, &iid, sizeof(iid));
if (qva->qva_mi == NULL) { if (qva->qva_mi == NULL) {
rpmError(RPMERR_QUERYINFO, _("no package matches %s: %s\n"), rpmlog(RPMERR_QUERYINFO, _("no package matches %s: %s\n"),
"tid", arg); "tid", arg);
res = 1; res = 1;
} else } else
@ -566,7 +566,7 @@ int rpmQueryVerify(QVA_t qva, rpmts ts, const char * arg)
case RPMQV_WHATREQUIRES: case RPMQV_WHATREQUIRES:
qva->qva_mi = rpmtsInitIterator(ts, RPMTAG_REQUIRENAME, arg, 0); qva->qva_mi = rpmtsInitIterator(ts, RPMTAG_REQUIRENAME, arg, 0);
if (qva->qva_mi == NULL) { if (qva->qva_mi == NULL) {
rpmError(RPMERR_QUERYINFO, _("no package requires %s\n"), arg); rpmlog(RPMERR_QUERYINFO, _("no package requires %s\n"), arg);
res = 1; res = 1;
} else } else
res = rpmcliShowMatches(qva, ts); res = rpmcliShowMatches(qva, ts);
@ -577,7 +577,7 @@ int rpmQueryVerify(QVA_t qva, rpmts ts, const char * arg)
provides_checked = 1; provides_checked = 1;
qva->qva_mi = rpmtsInitIterator(ts, RPMTAG_PROVIDENAME, arg, 0); qva->qva_mi = rpmtsInitIterator(ts, RPMTAG_PROVIDENAME, arg, 0);
if (qva->qva_mi == NULL) { if (qva->qva_mi == NULL) {
rpmError(RPMERR_QUERYINFO, _("no package provides %s\n"), arg); rpmlog(RPMERR_QUERYINFO, _("no package provides %s\n"), arg);
res = 1; res = 1;
} else } else
res = rpmcliShowMatches(qva, ts); res = rpmcliShowMatches(qva, ts);
@ -615,10 +615,10 @@ int rpmQueryVerify(QVA_t qva, rpmts ts, const char * arg)
} }
if (myerrno != 0) { if (myerrno != 0) {
rpmError(RPMERR_QUERY, _("file %s: %s\n"), fn, strerror(myerrno)); rpmlog(RPMERR_QUERY, _("file %s: %s\n"), fn, strerror(myerrno));
res = 1; res = 1;
} else if (qva->qva_mi == NULL) { } else if (qva->qva_mi == NULL) {
rpmError(RPMERR_QUERYINFO, rpmlog(RPMERR_QUERYINFO,
_("file %s is not owned by any package\n"), fn); _("file %s is not owned by any package\n"), fn);
res = 1; res = 1;
} else } else
@ -644,14 +644,14 @@ int rpmQueryVerify(QVA_t qva, rpmts ts, const char * arg)
} }
recOffset = strtoul(myarg, &end, mybase); recOffset = strtoul(myarg, &end, mybase);
if ((*end) || (end == arg) || (recOffset == ULONG_MAX)) { if ((*end) || (end == arg) || (recOffset == ULONG_MAX)) {
rpmError(RPMERR_QUERYINFO, _("invalid package number: %s\n"), arg); rpmlog(RPMERR_QUERYINFO, _("invalid package number: %s\n"), arg);
return 1; return 1;
} }
rpmMessage(RPMMESS_DEBUG, _("package record number: %u\n"), recOffset); rpmMessage(RPMMESS_DEBUG, _("package record number: %u\n"), recOffset);
/* RPMDBI_PACKAGES */ /* RPMDBI_PACKAGES */
qva->qva_mi = rpmtsInitIterator(ts, RPMDBI_PACKAGES, &recOffset, sizeof(recOffset)); qva->qva_mi = rpmtsInitIterator(ts, RPMDBI_PACKAGES, &recOffset, sizeof(recOffset));
if (qva->qva_mi == NULL) { if (qva->qva_mi == NULL) {
rpmError(RPMERR_QUERYINFO, rpmlog(RPMERR_QUERYINFO,
_("record %u could not be read\n"), recOffset); _("record %u could not be read\n"), recOffset);
res = 1; res = 1;
} else } else
@ -668,7 +668,7 @@ int rpmQueryVerify(QVA_t qva, rpmts ts, const char * arg)
} }
rpmdbFreeIterator(mi); rpmdbFreeIterator(mi);
if (! matches) { if (! matches) {
rpmError(RPMERR_QUERYINFO, _("package %s is not installed\n"), arg); rpmlog(RPMERR_QUERYINFO, _("package %s is not installed\n"), arg);
res = 1; res = 1;
} else { } else {
qva->qva_mi = rpmtsInitIterator(ts, RPMDBI_LABEL, arg, 0); qva->qva_mi = rpmtsInitIterator(ts, RPMDBI_LABEL, arg, 0);

View File

@ -42,7 +42,7 @@ static int manageFile(FD_t *fdp,
if (*fdp == NULL && fnp != NULL && *fnp != NULL) { if (*fdp == NULL && fnp != NULL && *fnp != NULL) {
fd = Fopen(*fnp, ((flags & O_WRONLY) ? "w.ufdio" : "r.ufdio")); fd = Fopen(*fnp, ((flags & O_WRONLY) ? "w.ufdio" : "r.ufdio"));
if (fd == NULL || Ferror(fd)) { if (fd == NULL || Ferror(fd)) {
rpmError(RPMERR_OPEN, _("%s: open failed: %s\n"), *fnp, rpmlog(RPMERR_OPEN, _("%s: open failed: %s\n"), *fnp,
Fstrerror(fd)); Fstrerror(fd));
return 1; return 1;
} }
@ -54,7 +54,7 @@ static int manageFile(FD_t *fdp,
if (*fdp == NULL && (fnp == NULL || *fnp == NULL)) { if (*fdp == NULL && (fnp == NULL || *fnp == NULL)) {
fn = NULL; fn = NULL;
if (makeTempFile(NULL, (fnp ? &fn : NULL), &fd)) { if (makeTempFile(NULL, (fnp ? &fn : NULL), &fd)) {
rpmError(RPMERR_MAKETEMP, _("makeTempFile failed\n")); rpmlog(RPMERR_MAKETEMP, _("makeTempFile failed\n"));
return 1; return 1;
} }
if (fnp != NULL) if (fnp != NULL)
@ -90,17 +90,17 @@ static int copyFile(FD_t *sfdp, const char **sfnp,
while ((count = Fread(buf, sizeof(buf[0]), sizeof(buf), *sfdp)) > 0) while ((count = Fread(buf, sizeof(buf[0]), sizeof(buf), *sfdp)) > 0)
{ {
if (Fwrite(buf, sizeof(buf[0]), count, *tfdp) != count) { if (Fwrite(buf, sizeof(buf[0]), count, *tfdp) != count) {
rpmError(RPMERR_FWRITE, _("%s: Fwrite failed: %s\n"), *tfnp, rpmlog(RPMERR_FWRITE, _("%s: Fwrite failed: %s\n"), *tfnp,
Fstrerror(*tfdp)); Fstrerror(*tfdp));
goto exit; goto exit;
} }
} }
if (count < 0) { if (count < 0) {
rpmError(RPMERR_FREAD, _("%s: Fread failed: %s\n"), *sfnp, Fstrerror(*sfdp)); rpmlog(RPMERR_FREAD, _("%s: Fread failed: %s\n"), *sfnp, Fstrerror(*sfdp));
goto exit; goto exit;
} }
if (Fflush(*tfdp) != 0) { if (Fflush(*tfdp) != 0) {
rpmError(RPMERR_FWRITE, _("%s: Fflush failed: %s\n"), *tfnp, rpmlog(RPMERR_FWRITE, _("%s: Fflush failed: %s\n"), *tfnp,
Fstrerror(*tfdp)); Fstrerror(*tfdp));
} }
@ -179,16 +179,16 @@ static int rpmReSign(rpmts ts,
memset(l, 0, sizeof(*l)); memset(l, 0, sizeof(*l));
rc = readLead(fd, l); rc = readLead(fd, l);
if (rc != RPMRC_OK) { if (rc != RPMRC_OK) {
rpmError(RPMERR_READLEAD, _("%s: not an rpm package\n"), rpm); rpmlog(RPMERR_READLEAD, _("%s: not an rpm package\n"), rpm);
goto exit; goto exit;
} }
switch (l->major) { switch (l->major) {
case 1: case 1:
rpmError(RPMERR_BADSIGTYPE, _("%s: Can't sign v1 packaging\n"), rpm); rpmlog(RPMERR_BADSIGTYPE, _("%s: Can't sign v1 packaging\n"), rpm);
goto exit; goto exit;
break; break;
case 2: case 2:
rpmError(RPMERR_BADSIGTYPE, _("%s: Can't re-sign v2 packaging\n"), rpm); rpmlog(RPMERR_BADSIGTYPE, _("%s: Can't re-sign v2 packaging\n"), rpm);
goto exit; goto exit;
break; break;
default: default:
@ -199,14 +199,14 @@ static int rpmReSign(rpmts ts,
rc = rpmReadSignature(fd, &sigh, l->signature_type, &msg); rc = rpmReadSignature(fd, &sigh, l->signature_type, &msg);
switch (rc) { switch (rc) {
default: default:
rpmError(RPMERR_SIGGEN, _("%s: rpmReadSignature failed: %s"), rpm, rpmlog(RPMERR_SIGGEN, _("%s: rpmReadSignature failed: %s"), rpm,
(msg && *msg ? msg : "\n")); (msg && *msg ? msg : "\n"));
msg = _free(msg); msg = _free(msg);
goto exit; goto exit;
break; break;
case RPMRC_OK: case RPMRC_OK:
if (sigh == NULL) { if (sigh == NULL) {
rpmError(RPMERR_SIGGEN, _("%s: No signature available\n"), rpm); rpmlog(RPMERR_SIGGEN, _("%s: No signature available\n"), rpm);
goto exit; goto exit;
} }
break; break;
@ -335,13 +335,13 @@ static int rpmReSign(rpmts ts,
l->signature_type = RPMSIGTYPE_HEADERSIG; l->signature_type = RPMSIGTYPE_HEADERSIG;
rc = writeLead(ofd, l); rc = writeLead(ofd, l);
if (rc != RPMRC_OK) { if (rc != RPMRC_OK) {
rpmError(RPMERR_WRITELEAD, _("%s: writeLead failed: %s\n"), trpm, rpmlog(RPMERR_WRITELEAD, _("%s: writeLead failed: %s\n"), trpm,
Fstrerror(ofd)); Fstrerror(ofd));
goto exit; goto exit;
} }
if (rpmWriteSignature(ofd, sigh)) { if (rpmWriteSignature(ofd, sigh)) {
rpmError(RPMERR_SIGGEN, _("%s: rpmWriteSignature failed: %s\n"), trpm, rpmlog(RPMERR_SIGGEN, _("%s: rpmWriteSignature failed: %s\n"), trpm,
Fstrerror(ofd)); Fstrerror(ofd));
goto exit; goto exit;
} }
@ -558,19 +558,19 @@ static int rpmcliImportPubkeys(const rpmts ts,
/* Read pgp packet. */ /* Read pgp packet. */
if ((rc = pgpReadPkts(fn, &pkt, &pktlen)) <= 0) { if ((rc = pgpReadPkts(fn, &pkt, &pktlen)) <= 0) {
rpmError(RPMERR_IMPORT, _("%s: import read failed(%d).\n"), fn, rc); rpmlog(RPMERR_IMPORT, _("%s: import read failed(%d).\n"), fn, rc);
res++; res++;
continue; continue;
} }
if (rc != PGPARMOR_PUBKEY) { if (rc != PGPARMOR_PUBKEY) {
rpmError(RPMERR_IMPORT, _("%s: not an armored public key.\n"), fn); rpmlog(RPMERR_IMPORT, _("%s: not an armored public key.\n"), fn);
res++; res++;
continue; continue;
} }
/* Import pubkey packet(s). */ /* Import pubkey packet(s). */
if ((rpmrc = rpmcliImportPubkey(ts, pkt, pktlen)) != RPMRC_OK) { if ((rpmrc = rpmcliImportPubkey(ts, pkt, pktlen)) != RPMRC_OK) {
rpmError(RPMERR_IMPORT, _("%s: import failed.\n"), fn); rpmlog(RPMERR_IMPORT, _("%s: import failed.\n"), fn);
res++; res++;
continue; continue;
} }
@ -602,7 +602,7 @@ static int readFile(FD_t fd, const char * fn, pgpDig dig)
/* Read the header from the package. */ /* Read the header from the package. */
{ Header h = headerRead(fd, HEADER_MAGIC_YES); { Header h = headerRead(fd, HEADER_MAGIC_YES);
if (h == NULL) { if (h == NULL) {
rpmError(RPMERR_FREAD, _("%s: headerRead failed\n"), fn); rpmlog(RPMERR_FREAD, _("%s: headerRead failed\n"), fn);
goto exit; goto exit;
} }
@ -616,7 +616,7 @@ static int readFile(FD_t fd, const char * fn, pgpDig dig)
|| uh == NULL) || uh == NULL)
{ {
h = headerFree(h); h = headerFree(h);
rpmError(RPMERR_FREAD, _("%s: headerGetEntry failed\n"), fn); rpmlog(RPMERR_FREAD, _("%s: headerGetEntry failed\n"), fn);
goto exit; goto exit;
} }
dig->hdrsha1ctx = rpmDigestInit(PGPHASHALGO_SHA1, RPMDIGEST_NONE); dig->hdrsha1ctx = rpmDigestInit(PGPHASHALGO_SHA1, RPMDIGEST_NONE);
@ -634,7 +634,7 @@ static int readFile(FD_t fd, const char * fn, pgpDig dig)
while ((count = Fread(buf, sizeof(buf[0]), sizeof(buf), fd)) > 0) while ((count = Fread(buf, sizeof(buf[0]), sizeof(buf), fd)) > 0)
dig->nbytes += count; dig->nbytes += count;
if (count < 0) { if (count < 0) {
rpmError(RPMERR_FREAD, _("%s: Fread failed: %s\n"), fn, Fstrerror(fd)); rpmlog(RPMERR_FREAD, _("%s: Fread failed: %s\n"), fn, Fstrerror(fd));
goto exit; goto exit;
} }
@ -697,13 +697,13 @@ int rpmVerifySignatures(QVA_t qva, rpmts ts, FD_t fd,
memset(l, 0, sizeof(*l)); memset(l, 0, sizeof(*l));
rc = readLead(fd, l); rc = readLead(fd, l);
if (rc != RPMRC_OK) { if (rc != RPMRC_OK) {
rpmError(RPMERR_READLEAD, _("%s: not an rpm package\n"), fn); rpmlog(RPMERR_READLEAD, _("%s: not an rpm package\n"), fn);
res++; res++;
goto exit; goto exit;
} }
switch (l->major) { switch (l->major) {
case 1: case 1:
rpmError(RPMERR_BADSIGTYPE, _("%s: No signature available (v1.0 RPM)\n"), fn); rpmlog(RPMERR_BADSIGTYPE, _("%s: No signature available (v1.0 RPM)\n"), fn);
res++; res++;
goto exit; goto exit;
break; break;
@ -715,7 +715,7 @@ int rpmVerifySignatures(QVA_t qva, rpmts ts, FD_t fd,
rc = rpmReadSignature(fd, &sigh, l->signature_type, &msg); rc = rpmReadSignature(fd, &sigh, l->signature_type, &msg);
switch (rc) { switch (rc) {
default: default:
rpmError(RPMERR_SIGGEN, _("%s: rpmReadSignature failed: %s"), fn, rpmlog(RPMERR_SIGGEN, _("%s: rpmReadSignature failed: %s"), fn,
(msg && *msg ? msg : "\n")); (msg && *msg ? msg : "\n"));
msg = _free(msg); msg = _free(msg);
res++; res++;
@ -723,7 +723,7 @@ int rpmVerifySignatures(QVA_t qva, rpmts ts, FD_t fd,
break; break;
case RPMRC_OK: case RPMRC_OK:
if (sigh == NULL) { if (sigh == NULL) {
rpmError(RPMERR_SIGGEN, _("%s: No signature available\n"), fn); rpmlog(RPMERR_SIGGEN, _("%s: No signature available\n"), fn);
res++; res++;
goto exit; goto exit;
} }
@ -810,7 +810,7 @@ int rpmVerifySignatures(QVA_t qva, rpmts ts, FD_t fd,
(_print_pkts & rpmIsDebug())); (_print_pkts & rpmIsDebug()));
if (sigp->version != 3 && sigp->version != 4) { if (sigp->version != 3 && sigp->version != 4) {
rpmError(RPMERR_SIGVFY, rpmlog(RPMERR_SIGVFY,
_("skipping package %s with unverifiable V%u signature\n"), _("skipping package %s with unverifiable V%u signature\n"),
fn, sigp->version); fn, sigp->version);
res++; res++;
@ -972,9 +972,9 @@ int rpmVerifySignatures(QVA_t qva, rpmts ts, FD_t fd,
if (res2) { if (res2) {
if (rpmIsVerbose()) { if (rpmIsVerbose()) {
rpmError(RPMERR_SIGVFY, "%s", buf); rpmlog(RPMERR_SIGVFY, "%s", buf);
} else { } else {
rpmError(RPMERR_SIGVFY, "%s%s%s%s%s%s%s%s\n", buf, rpmlog(RPMERR_SIGVFY, "%s%s%s%s%s%s%s%s\n", buf,
_("NOT OK"), _("NOT OK"),
(missingKeys[0] != '\0') ? _(" (MISSING KEYS:") : "", (missingKeys[0] != '\0') ? _(" (MISSING KEYS:") : "",
missingKeys, missingKeys,
@ -986,9 +986,9 @@ int rpmVerifySignatures(QVA_t qva, rpmts ts, FD_t fd,
} }
} else { } else {
if (rpmIsVerbose()) { if (rpmIsVerbose()) {
rpmError(RPMERR_SIGVFY, "%s", buf); rpmlog(RPMERR_SIGVFY, "%s", buf);
} else { } else {
rpmError(RPMERR_SIGVFY, "%s%s%s%s%s%s%s%s\n", buf, rpmlog(RPMERR_SIGVFY, "%s%s%s%s%s%s%s%s\n", buf,
_("OK"), _("OK"),
(missingKeys[0] != '\0') ? _(" (MISSING KEYS:") : "", (missingKeys[0] != '\0') ? _(" (MISSING KEYS:") : "",
missingKeys, missingKeys,
@ -1037,7 +1037,7 @@ int rpmcliSign(rpmts ts, QVA_t qva, const char ** argv)
fd = Fopen(arg, "r.ufdio"); fd = Fopen(arg, "r.ufdio");
if (fd == NULL || Ferror(fd)) { if (fd == NULL || Ferror(fd)) {
rpmError(RPMERR_OPEN, _("%s: open failed: %s\n"), rpmlog(RPMERR_OPEN, _("%s: open failed: %s\n"),
arg, Fstrerror(fd)); arg, Fstrerror(fd));
res++; res++;
} else if (rpmVerifySignatures(qva, ts, fd, arg)) { } else if (rpmVerifySignatures(qva, ts, fd, arg)) {

View File

@ -62,7 +62,7 @@ static FD_t rpmgiOpen(const char * path, const char * fmode)
FD_t fd = Fopen(fn, fmode); FD_t fd = Fopen(fn, fmode);
if (fd == NULL || Ferror(fd)) { if (fd == NULL || Ferror(fd)) {
rpmError(RPMERR_OPEN, _("open of %s failed: %s\n"), fn, Fstrerror(fd)); rpmlog(RPMERR_OPEN, _("open of %s failed: %s\n"), fn, Fstrerror(fd));
if (fd != NULL) (void) Fclose(fd); if (fd != NULL) (void) Fclose(fd);
fd = NULL; fd = NULL;
} }
@ -320,7 +320,7 @@ fprintf(stderr, "*** gi %p\tmi %p\n", gi, gi->mi);
*ae++ = '\0'; *ae++ = '\0';
tag = rpmTagGetValue(a); tag = rpmTagGetValue(a);
if (tag < 0) { if (tag < 0) {
rpmError(RPMERR_QUERYINFO, _("unknown tag: \"%s\"\n"), a); rpmlog(RPMERR_QUERYINFO, _("unknown tag: \"%s\"\n"), a);
res = 1; res = 1;
} }
pat = ae; pat = ae;

View File

@ -93,7 +93,7 @@ void * rpmShowProgress(const void * arg,
fd = Fopen(filename, "r.ufdio"); fd = Fopen(filename, "r.ufdio");
/* FIX: still necessary? */ /* FIX: still necessary? */
if (fd == NULL || Ferror(fd)) { if (fd == NULL || Ferror(fd)) {
rpmError(RPMERR_OPEN, _("open of %s failed: %s\n"), filename, rpmlog(RPMERR_OPEN, _("open of %s failed: %s\n"), filename,
Fstrerror(fd)); Fstrerror(fd));
if (fd != NULL) { if (fd != NULL) {
xx = Fclose(fd); xx = Fclose(fd);
@ -302,7 +302,7 @@ const char * fileURL = NULL;
av = _free(av); ac = 0; av = _free(av); ac = 0;
rc = rpmGlob(*eiu->fnp, &ac, &av); rc = rpmGlob(*eiu->fnp, &ac, &av);
if (rc || ac == 0) { if (rc || ac == 0) {
rpmError(RPMERR_OPEN, _("File not found by glob: %s\n"), *eiu->fnp); rpmlog(RPMERR_OPEN, _("File not found by glob: %s\n"), *eiu->fnp);
continue; continue;
} }
@ -419,7 +419,7 @@ if (fileURL[0] == '=') {
/* Try to read the header from a package file. */ /* Try to read the header from a package file. */
eiu->fd = Fopen(*eiu->fnp, "r.ufdio"); eiu->fd = Fopen(*eiu->fnp, "r.ufdio");
if (eiu->fd == NULL || Ferror(eiu->fd)) { if (eiu->fd == NULL || Ferror(eiu->fd)) {
rpmError(RPMERR_OPEN, _("open of %s failed: %s\n"), *eiu->fnp, rpmlog(RPMERR_OPEN, _("open of %s failed: %s\n"), *eiu->fnp,
Fstrerror(eiu->fd)); Fstrerror(eiu->fd));
if (eiu->fd != NULL) { if (eiu->fd != NULL) {
xx = Fclose(eiu->fd); xx = Fclose(eiu->fd);
@ -551,7 +551,7 @@ maybe_manifest:
/* Try to read a package manifest. */ /* Try to read a package manifest. */
eiu->fd = Fopen(*eiu->fnp, "r.fpio"); eiu->fd = Fopen(*eiu->fnp, "r.fpio");
if (eiu->fd == NULL || Ferror(eiu->fd)) { if (eiu->fd == NULL || Ferror(eiu->fd)) {
rpmError(RPMERR_OPEN, _("open of %s failed: %s\n"), *eiu->fnp, rpmlog(RPMERR_OPEN, _("open of %s failed: %s\n"), *eiu->fnp,
Fstrerror(eiu->fd)); Fstrerror(eiu->fd));
if (eiu->fd != NULL) { if (eiu->fd != NULL) {
xx = Fclose(eiu->fd); xx = Fclose(eiu->fd);
@ -565,7 +565,7 @@ maybe_manifest:
/* FIX: *eiu->argv can be NULL */ /* FIX: *eiu->argv can be NULL */
rc = rpmReadPackageManifest(eiu->fd, &eiu->argc, &eiu->argv); rc = rpmReadPackageManifest(eiu->fd, &eiu->argc, &eiu->argv);
if (rc != RPMRC_OK) if (rc != RPMRC_OK)
rpmError(RPMERR_MANIFEST, _("%s: not an rpm package (or package manifest): %s\n"), rpmlog(RPMERR_MANIFEST, _("%s: not an rpm package (or package manifest): %s\n"),
*eiu->fnp, Fstrerror(eiu->fd)); *eiu->fnp, Fstrerror(eiu->fd));
xx = Fclose(eiu->fd); xx = Fclose(eiu->fd);
eiu->fd = NULL; eiu->fd = NULL;

View File

@ -42,7 +42,7 @@ rpmRC readLead(FD_t fd, struct rpmlead *lead)
/* FIX: remove timed read */ /* FIX: remove timed read */
if (timedRead(fd, (char *)lead, sizeof(*lead)) != sizeof(*lead)) { if (timedRead(fd, (char *)lead, sizeof(*lead)) != sizeof(*lead)) {
if (Ferror(fd)) { if (Ferror(fd)) {
rpmError(RPMERR_READ, _("read failed: %s (%d)\n"), rpmlog(RPMERR_READ, _("read failed: %s (%d)\n"),
Fstrerror(fd), errno); Fstrerror(fd), errno);
return RPMRC_FAIL; return RPMRC_FAIL;
} }

View File

@ -181,10 +181,10 @@ static int machCompatCacheAdd(char * name, const char * fn, int linenum,
chptr = name; chptr = name;
while (*chptr && *chptr != ':') chptr++; while (*chptr && *chptr != ':') chptr++;
if (!*chptr) { if (!*chptr) {
rpmError(RPMERR_RPMRC, _("missing second ':' at %s:%d\n"), fn, linenum); rpmlog(RPMERR_RPMRC, _("missing second ':' at %s:%d\n"), fn, linenum);
return 1; return 1;
} else if (chptr == name) { } else if (chptr == name) {
rpmError(RPMERR_RPMRC, _("missing architecture name at %s:%d\n"), fn, rpmlog(RPMERR_RPMRC, _("missing architecture name at %s:%d\n"), fn,
linenum); linenum);
return 1; return 1;
} }
@ -329,12 +329,12 @@ static int addCanon(canonEntry * table, int * tableLen, char * line,
tshort_name = strtok(NULL, " \t"); tshort_name = strtok(NULL, " \t");
s = strtok(NULL, " \t"); s = strtok(NULL, " \t");
if (! (tname && tshort_name && s)) { if (! (tname && tshort_name && s)) {
rpmError(RPMERR_RPMRC, _("Incomplete data line at %s:%d\n"), rpmlog(RPMERR_RPMRC, _("Incomplete data line at %s:%d\n"),
fn, lineNum); fn, lineNum);
return RPMERR_RPMRC; return RPMERR_RPMRC;
} }
if (strtok(NULL, " \t")) { if (strtok(NULL, " \t")) {
rpmError(RPMERR_RPMRC, _("Too many args in data line at %s:%d\n"), rpmlog(RPMERR_RPMRC, _("Too many args in data line at %s:%d\n"),
fn, lineNum); fn, lineNum);
return RPMERR_RPMRC; return RPMERR_RPMRC;
} }
@ -342,7 +342,7 @@ static int addCanon(canonEntry * table, int * tableLen, char * line,
/* LCL: s != NULL here. */ /* LCL: s != NULL here. */
tnum = strtoul(s, &s1, 10); tnum = strtoul(s, &s1, 10);
if ((*s1) || (s1 == s) || (tnum == ULONG_MAX)) { if ((*s1) || (s1 == s) || (tnum == ULONG_MAX)) {
rpmError(RPMERR_RPMRC, _("Bad arch/os number: %s (%s:%d)\n"), s, rpmlog(RPMERR_RPMRC, _("Bad arch/os number: %s (%s:%d)\n"), s,
fn, lineNum); fn, lineNum);
return(RPMERR_RPMRC); return(RPMERR_RPMRC);
} }
@ -373,12 +373,12 @@ static int addDefault(defaultEntry * table, int * tableLen, char * line,
t->name = strtok(line, ": \t"); t->name = strtok(line, ": \t");
t->defName = strtok(NULL, " \t"); t->defName = strtok(NULL, " \t");
if (! (t->name && t->defName)) { if (! (t->name && t->defName)) {
rpmError(RPMERR_RPMRC, _("Incomplete default line at %s:%d\n"), rpmlog(RPMERR_RPMRC, _("Incomplete default line at %s:%d\n"),
fn, lineNum); fn, lineNum);
return RPMERR_RPMRC; return RPMERR_RPMRC;
} }
if (strtok(NULL, " \t")) { if (strtok(NULL, " \t")) {
rpmError(RPMERR_RPMRC, _("Too many args in default line at %s:%d\n"), rpmlog(RPMERR_RPMRC, _("Too many args in default line at %s:%d\n"),
fn, lineNum); fn, lineNum);
return RPMERR_RPMRC; return RPMERR_RPMRC;
} }
@ -530,7 +530,7 @@ static int doReadRC( FD_t fd, const char * urlfn)
next[0] = '\0'; next[0] = '\0';
rc = Fread(next, sizeof(*next), nb, fd); rc = Fread(next, sizeof(*next), nb, fd);
if (Ferror(fd) || (size > 0 && rc != nb)) { /* XXX Feof(fd) */ if (Ferror(fd) || (size > 0 && rc != nb)) { /* XXX Feof(fd) */
rpmError(RPMERR_RPMRC, _("Failed to read %s: %s.\n"), urlfn, rpmlog(RPMERR_RPMRC, _("Failed to read %s: %s.\n"), urlfn,
Fstrerror(fd)); Fstrerror(fd));
rc = 1; rc = 1;
} else } else
@ -567,7 +567,7 @@ static int doReadRC( FD_t fd, const char * urlfn)
} }
if (*se != ':') { if (*se != ':') {
rpmError(RPMERR_RPMRC, _("missing ':' (found 0x%02x) at %s:%d\n"), rpmlog(RPMERR_RPMRC, _("missing ':' (found 0x%02x) at %s:%d\n"),
(unsigned)(0xff & *se), urlfn, linenum); (unsigned)(0xff & *se), urlfn, linenum);
return 1; return 1;
} }
@ -584,7 +584,7 @@ static int doReadRC( FD_t fd, const char * urlfn)
arch = val = fn = NULL; arch = val = fn = NULL;
if (*se == '\0') { if (*se == '\0') {
rpmError(RPMERR_RPMRC, _("missing argument for %s at %s:%d\n"), rpmlog(RPMERR_RPMRC, _("missing argument for %s at %s:%d\n"),
option->name, urlfn, linenum); option->name, urlfn, linenum);
return 1; return 1;
} }
@ -601,7 +601,7 @@ static int doReadRC( FD_t fd, const char * urlfn)
fn = rpmGetPath(s, NULL); fn = rpmGetPath(s, NULL);
if (fn == NULL || *fn == '\0') { if (fn == NULL || *fn == '\0') {
rpmError(RPMERR_RPMRC, _("%s expansion failed at %s:%d \"%s\"\n"), rpmlog(RPMERR_RPMRC, _("%s expansion failed at %s:%d \"%s\"\n"),
option->name, urlfn, linenum, s); option->name, urlfn, linenum, s);
fn = _free(fn); fn = _free(fn);
return 1; return 1;
@ -609,7 +609,7 @@ static int doReadRC( FD_t fd, const char * urlfn)
fdinc = Fopen(fn, "r.fpio"); fdinc = Fopen(fn, "r.fpio");
if (fdinc == NULL || Ferror(fdinc)) { if (fdinc == NULL || Ferror(fdinc)) {
rpmError(RPMERR_RPMRC, _("cannot open %s at %s:%d: %s\n"), rpmlog(RPMERR_RPMRC, _("cannot open %s at %s:%d: %s\n"),
fn, urlfn, linenum, Fstrerror(fdinc)); fn, urlfn, linenum, Fstrerror(fdinc));
rc = 1; rc = 1;
} else { } else {
@ -627,7 +627,7 @@ static int doReadRC( FD_t fd, const char * urlfn)
arch = se; arch = se;
while (*se && !xisspace(*se)) se++; while (*se && !xisspace(*se)) se++;
if (*se == '\0') { if (*se == '\0') {
rpmError(RPMERR_RPMRC, rpmlog(RPMERR_RPMRC,
_("missing architecture for %s at %s:%d\n"), _("missing architecture for %s at %s:%d\n"),
option->name, urlfn, linenum); option->name, urlfn, linenum);
return 1; return 1;
@ -635,7 +635,7 @@ static int doReadRC( FD_t fd, const char * urlfn)
*se++ = '\0'; *se++ = '\0';
while (*se && xisspace(*se)) se++; while (*se && xisspace(*se)) se++;
if (*se == '\0') { if (*se == '\0') {
rpmError(RPMERR_RPMRC, rpmlog(RPMERR_RPMRC,
_("missing argument for %s at %s:%d\n"), _("missing argument for %s at %s:%d\n"),
option->name, urlfn, linenum); option->name, urlfn, linenum);
return 1; return 1;
@ -695,7 +695,7 @@ static int doReadRC( FD_t fd, const char * urlfn)
} }
if (!gotit) { if (!gotit) {
rpmError(RPMERR_RPMRC, _("bad option '%s' at %s:%d\n"), rpmlog(RPMERR_RPMRC, _("bad option '%s' at %s:%d\n"),
s, urlfn, linenum); s, urlfn, linenum);
} }
} }
@ -1663,12 +1663,12 @@ static int rpmReadRC(const char * rcfiles)
/* XXX Only /usr/lib/rpm/rpmrc must exist in default rcfiles list */ /* XXX Only /usr/lib/rpm/rpmrc must exist in default rcfiles list */
if (rcfiles == defrcfiles && myrcfiles != r) if (rcfiles == defrcfiles && myrcfiles != r)
continue; continue;
rpmError(RPMERR_RPMRC, _("Cannot expand %s\n"), r); rpmlog(RPMERR_RPMRC, _("Cannot expand %s\n"), r);
rc = 1; rc = 1;
break; break;
} }
if (strlen(home) > (sizeof(fn) - strlen(r))) { if (strlen(home) > (sizeof(fn) - strlen(r))) {
rpmError(RPMERR_RPMRC, _("Cannot read %s, HOME is too large.\n"), rpmlog(RPMERR_RPMRC, _("Cannot read %s, HOME is too large.\n"),
r); r);
rc = 1; rc = 1;
break; break;
@ -1685,7 +1685,7 @@ static int rpmReadRC(const char * rcfiles)
/* XXX Only /usr/lib/rpm/rpmrc must exist in default rcfiles list */ /* XXX Only /usr/lib/rpm/rpmrc must exist in default rcfiles list */
if (rcfiles == defrcfiles && myrcfiles != r) if (rcfiles == defrcfiles && myrcfiles != r)
continue; continue;
rpmError(RPMERR_RPMRC, _("Unable to open %s for reading: %s.\n"), rpmlog(RPMERR_RPMRC, _("Unable to open %s for reading: %s.\n"),
fn, Fstrerror(fd)); fn, Fstrerror(fd));
rc = 1; rc = 1;
break; break;

View File

@ -246,7 +246,7 @@ rpmdbMatchIterator rpmtsInitIterator(const rpmts ts, rpmTag rpmtag,
case '(': case '(':
/* XXX Fail if nested parens. */ /* XXX Fail if nested parens. */
if (level++ != 0) { if (level++ != 0) {
rpmError(RPMERR_QFMT, _("extra '(' in package label: %s\n"), keyp); rpmlog(RPMERR_QFMT, _("extra '(' in package label: %s\n"), keyp);
return NULL; return NULL;
} }
/* Parse explicit epoch. */ /* Parse explicit epoch. */
@ -264,7 +264,7 @@ rpmdbMatchIterator rpmtsInitIterator(const rpmts ts, rpmTag rpmtag,
case ')': case ')':
/* XXX Fail if nested parens. */ /* XXX Fail if nested parens. */
if (--level != 0) { if (--level != 0) {
rpmError(RPMERR_QFMT, _("missing '(' in package label: %s\n"), keyp); rpmlog(RPMERR_QFMT, _("missing '(' in package label: %s\n"), keyp);
return NULL; return NULL;
} }
/* Don't copy trailing ')' */ /* Don't copy trailing ')' */
@ -272,7 +272,7 @@ rpmdbMatchIterator rpmtsInitIterator(const rpmts ts, rpmTag rpmtag,
} }
} }
if (level) { if (level) {
rpmError(RPMERR_QFMT, _("missing ')' in package label: %s\n"), keyp); rpmlog(RPMERR_QFMT, _("missing ')' in package label: %s\n"), keyp);
return NULL; return NULL;
} }
*t = '\0'; *t = '\0';
@ -582,7 +582,7 @@ int rpmtsSolve(rpmts ts, rpmds ds, const void * data)
bh = headerFree(bh); bh = headerFree(bh);
qfmt = _free(qfmt); qfmt = _free(qfmt);
if (str == NULL) { if (str == NULL) {
rpmError(RPMERR_QFMT, _("incorrect format: %s\n"), errstr); rpmlog(RPMERR_QFMT, _("incorrect format: %s\n"), errstr);
goto exit; goto exit;
} }
@ -593,7 +593,7 @@ int rpmtsSolve(rpmts ts, rpmds ds, const void * data)
h = headerFree(h); h = headerFree(h);
fd = Fopen(str, "r.ufdio"); fd = Fopen(str, "r.ufdio");
if (fd == NULL || Ferror(fd)) { if (fd == NULL || Ferror(fd)) {
rpmError(RPMERR_OPEN, _("open of %s failed: %s\n"), str, rpmlog(RPMERR_OPEN, _("open of %s failed: %s\n"), str,
Fstrerror(fd)); Fstrerror(fd));
if (fd != NULL) { if (fd != NULL) {
xx = Fclose(fd); xx = Fclose(fd);

View File

@ -403,7 +403,7 @@ static int makePGPSignature(const char * file, int_32 * sigTagp,
break; break;
} }
} }
rpmError(RPMERR_EXEC, _("Could not exec %s: %s\n"), "pgp", rpmlog(RPMERR_EXEC, _("Could not exec %s: %s\n"), "pgp",
strerror(errno)); strerror(errno));
_exit(RPMERR_EXEC); _exit(RPMERR_EXEC);
} }
@ -419,14 +419,14 @@ static int makePGPSignature(const char * file, int_32 * sigTagp,
(void)waitpid(pid, &status, 0); (void)waitpid(pid, &status, 0);
if (!WIFEXITED(status) || WEXITSTATUS(status)) { if (!WIFEXITED(status) || WEXITSTATUS(status)) {
rpmError(RPMERR_SIGGEN, _("pgp failed\n")); rpmlog(RPMERR_SIGGEN, _("pgp failed\n"));
return 1; return 1;
} }
if (stat(sigfile, &st)) { if (stat(sigfile, &st)) {
/* PGP failed to write signature */ /* PGP failed to write signature */
if (sigfile) (void) unlink(sigfile); /* Just in case */ if (sigfile) (void) unlink(sigfile); /* Just in case */
rpmError(RPMERR_SIGGEN, _("pgp failed to write signature\n")); rpmlog(RPMERR_SIGGEN, _("pgp failed to write signature\n"));
return 1; return 1;
} }
@ -445,7 +445,7 @@ static int makePGPSignature(const char * file, int_32 * sigTagp,
} }
if (rc != *pktlenp) { if (rc != *pktlenp) {
*pktp = _free(*pktp); *pktp = _free(*pktp);
rpmError(RPMERR_SIGGEN, _("unable to read the signature\n")); rpmlog(RPMERR_SIGGEN, _("unable to read the signature\n"));
return 1; return 1;
} }
} }
@ -514,7 +514,7 @@ static int makeGPGSignature(const char * file, int_32 * sigTagp,
if (!rc) if (!rc)
rc = execve(av[0], av+1, environ); rc = execve(av[0], av+1, environ);
rpmError(RPMERR_EXEC, _("Could not exec %s: %s\n"), "gpg", rpmlog(RPMERR_EXEC, _("Could not exec %s: %s\n"), "gpg",
strerror(errno)); strerror(errno));
_exit(RPMERR_EXEC); _exit(RPMERR_EXEC);
} }
@ -531,14 +531,14 @@ static int makeGPGSignature(const char * file, int_32 * sigTagp,
(void) waitpid(pid, &status, 0); (void) waitpid(pid, &status, 0);
if (!WIFEXITED(status) || WEXITSTATUS(status)) { if (!WIFEXITED(status) || WEXITSTATUS(status)) {
rpmError(RPMERR_SIGGEN, _("gpg exec failed (%d)\n"), WEXITSTATUS(status)); rpmlog(RPMERR_SIGGEN, _("gpg exec failed (%d)\n"), WEXITSTATUS(status));
return 1; return 1;
} }
if (stat(sigfile, &st)) { if (stat(sigfile, &st)) {
/* GPG failed to write signature */ /* GPG failed to write signature */
if (sigfile) (void) unlink(sigfile); /* Just in case */ if (sigfile) (void) unlink(sigfile); /* Just in case */
rpmError(RPMERR_SIGGEN, _("gpg failed to write signature\n")); rpmlog(RPMERR_SIGGEN, _("gpg failed to write signature\n"));
return 1; return 1;
} }
@ -557,7 +557,7 @@ static int makeGPGSignature(const char * file, int_32 * sigTagp,
} }
if (rc != *pktlenp) { if (rc != *pktlenp) {
*pktp = _free(*pktp); *pktp = _free(*pktp);
rpmError(RPMERR_SIGGEN, _("unable to read the signature\n")); rpmlog(RPMERR_SIGGEN, _("unable to read the signature\n"));
return 1; return 1;
} }
} }
@ -807,7 +807,7 @@ static int checkPassPhrase(const char * passPhrase, const int sigTag)
if (!rc) if (!rc)
rc = execve(av[0], av+1, environ); rc = execve(av[0], av+1, environ);
rpmError(RPMERR_EXEC, _("Could not exec %s: %s\n"), "gpg", rpmlog(RPMERR_EXEC, _("Could not exec %s: %s\n"), "gpg",
strerror(errno)); strerror(errno));
} break; } break;
case RPMSIGTAG_RSA: case RPMSIGTAG_RSA:
@ -840,12 +840,12 @@ static int checkPassPhrase(const char * passPhrase, const int sigTag)
break; break;
} }
} }
rpmError(RPMERR_EXEC, _("Could not exec %s: %s\n"), "pgp", rpmlog(RPMERR_EXEC, _("Could not exec %s: %s\n"), "pgp",
strerror(errno)); strerror(errno));
_exit(RPMERR_EXEC); _exit(RPMERR_EXEC);
} break; } break;
default: /* This case should have been screened out long ago. */ default: /* This case should have been screened out long ago. */
rpmError(RPMERR_SIGGEN, _("Invalid %%_signature spec in macro file\n")); rpmlog(RPMERR_SIGGEN, _("Invalid %%_signature spec in macro file\n"));
_exit(RPMERR_SIGGEN); _exit(RPMERR_SIGGEN);
break; break;
} }
@ -875,7 +875,7 @@ char * rpmGetPassPhrase(const char * prompt, const int sigTag)
} }
if (aok) if (aok)
break; break;
rpmError(RPMERR_SIGGEN, rpmlog(RPMERR_SIGGEN,
_("You must set \"%%_gpg_name\" in your macro file\n")); _("You must set \"%%_gpg_name\" in your macro file\n"));
break; break;
case RPMSIGTAG_RSA: case RPMSIGTAG_RSA:
@ -887,14 +887,14 @@ char * rpmGetPassPhrase(const char * prompt, const int sigTag)
} }
if (aok) if (aok)
break; break;
rpmError(RPMERR_SIGGEN, rpmlog(RPMERR_SIGGEN,
_("You must set \"%%_pgp_name\" in your macro file\n")); _("You must set \"%%_pgp_name\" in your macro file\n"));
break; break;
default: default:
/* Currently the calling function (rpm.c:main) is checking this and /* Currently the calling function (rpm.c:main) is checking this and
* doing a better job. This section should never be accessed. * doing a better job. This section should never be accessed.
*/ */
rpmError(RPMERR_SIGGEN, _("Invalid %%_signature spec in macro file\n")); rpmlog(RPMERR_SIGGEN, _("Invalid %%_signature spec in macro file\n"));
break; break;
} }

View File

@ -146,10 +146,10 @@ static int cvtdberr(dbiIndex dbi, const char * msg, int error, int printit)
if (printit && rc) { if (printit && rc) {
if (msg) if (msg)
rpmError(RPMERR_DBERR, _("db%d error(%d) from %s: %s\n"), rpmlog(RPMERR_DBERR, _("db%d error(%d) from %s: %s\n"),
dbi->dbi_api, rc, msg, db_strerror(error)); dbi->dbi_api, rc, msg, db_strerror(error));
else else
rpmError(RPMERR_DBERR, _("db%d error(%d): %s\n"), rpmlog(RPMERR_DBERR, _("db%d error(%d): %s\n"),
dbi->dbi_api, rc, db_strerror(error)); dbi->dbi_api, rc, db_strerror(error));
} }
@ -1156,7 +1156,7 @@ static int db3open(rpmdb rpmdb, rpmTag rpmtag, dbiIndex * dbip)
(dbi->dbi_eflags & DB_INIT_CDB) && (dbi->dbi_eflags & DB_INIT_CDB) &&
!(dbi->dbi_eflags & DB_PRIVATE)) !(dbi->dbi_eflags & DB_PRIVATE))
? 0 : 1); ? 0 : 1);
rpmError( (rc ? RPMERR_FLOCK : RPMWARN_FLOCK), rpmlog( (rc ? RPMERR_FLOCK : RPMWARN_FLOCK),
_("cannot get %s lock on %s/%s\n"), _("cannot get %s lock on %s/%s\n"),
((dbi->dbi_mode & (O_RDWR|O_WRONLY)) ((dbi->dbi_mode & (O_RDWR|O_WRONLY))
? _("exclusive") : _("shared")), ? _("exclusive") : _("shared")),

View File

@ -321,7 +321,7 @@ dbiIndex db3New(rpmdb rpmdb, rpmTag rpmtag)
break; break;
} }
if (opt->longName == NULL) { if (opt->longName == NULL) {
rpmError(RPMERR_DBCONFIG, rpmlog(RPMERR_DBCONFIG,
_("unrecognized db option: \"%s\" ignored.\n"), o); _("unrecognized db option: \"%s\" ignored.\n"), o);
continue; continue;
} }
@ -358,7 +358,7 @@ dbiIndex db3New(rpmdb rpmdb, rpmTag rpmtag)
else if (!xstrncasecmp(pe, "Kb", 2)) else if (!xstrncasecmp(pe, "Kb", 2))
aLong *= 1024; aLong *= 1024;
else if (*pe != '\0') { else if (*pe != '\0') {
rpmError(RPMERR_DBCONFIG, rpmlog(RPMERR_DBCONFIG,
_("%s has invalid numeric value, skipped\n"), _("%s has invalid numeric value, skipped\n"),
opt->longName); opt->longName);
continue; continue;
@ -367,7 +367,7 @@ dbiIndex db3New(rpmdb rpmdb, rpmTag rpmtag)
if ((argInfo & POPT_ARG_MASK) == POPT_ARG_LONG) { if ((argInfo & POPT_ARG_MASK) == POPT_ARG_LONG) {
if (aLong == LONG_MIN || aLong == LONG_MAX) { if (aLong == LONG_MIN || aLong == LONG_MAX) {
rpmError(RPMERR_DBCONFIG, rpmlog(RPMERR_DBCONFIG,
_("%s has too large or too small long value, skipped\n"), _("%s has too large or too small long value, skipped\n"),
opt->longName); opt->longName);
continue; continue;
@ -376,7 +376,7 @@ dbiIndex db3New(rpmdb rpmdb, rpmTag rpmtag)
break; break;
} else { } else {
if (aLong > INT_MAX || aLong < INT_MIN) { if (aLong > INT_MAX || aLong < INT_MIN) {
rpmError(RPMERR_DBCONFIG, rpmlog(RPMERR_DBCONFIG,
_("%s has too large or too small integer value, skipped\n"), _("%s has too large or too small integer value, skipped\n"),
opt->longName); opt->longName);
continue; continue;

View File

@ -243,7 +243,7 @@ dbiIndex dbiOpen(rpmdb db, rpmTag rpmtag, unsigned int flags)
if (rc) { if (rc) {
static int _printed[32]; static int _printed[32];
if (!_printed[dbix & 0x1f]++) if (!_printed[dbix & 0x1f]++)
rpmError(RPMERR_DBOPEN, rpmlog(RPMERR_DBOPEN,
_("cannot open %s index using db%d - %s (%d)\n"), _("cannot open %s index using db%d - %s (%d)\n"),
rpmTagGetName(rpmtag), _dbapi, rpmTagGetName(rpmtag), _dbapi,
(rc > 0 ? strerror(rc) : ""), rc); (rc > 0 ? strerror(rc) : ""), rc);
@ -264,7 +264,7 @@ dbiIndex dbiOpen(rpmdb db, rpmTag rpmtag, unsigned int flags)
if (_dbapi <= 0) { if (_dbapi <= 0) {
static int _printed[32]; static int _printed[32];
if (!_printed[dbix & 0x1f]++) if (!_printed[dbix & 0x1f]++)
rpmError(RPMERR_DBOPEN, _("cannot open %s index\n"), rpmlog(RPMERR_DBOPEN, _("cannot open %s index\n"),
rpmTagGetName(rpmtag)); rpmTagGetName(rpmtag));
rc = 1; rc = 1;
goto exit; goto exit;
@ -900,7 +900,7 @@ rpmdb newRpmdb(const char * root,
db->db_root = rpmGetPath(_DB_ROOT, NULL); db->db_root = rpmGetPath(_DB_ROOT, NULL);
db->db_home = rpmGetPath( (home && *home ? home : _DB_HOME), NULL); db->db_home = rpmGetPath( (home && *home ? home : _DB_HOME), NULL);
if (!(db->db_home && db->db_home[0] != '%')) { if (!(db->db_home && db->db_home[0] != '%')) {
rpmError(RPMERR_DBOPEN, _("no dbpath has been set\n")); rpmlog(RPMERR_DBOPEN, _("no dbpath has been set\n"));
db->db_root = _free(db->db_root); db->db_root = _free(db->db_root);
db->db_home = _free(db->db_home); db->db_home = _free(db->db_home);
db = _free(db); db = _free(db);
@ -1136,7 +1136,7 @@ if (key->size == 0) key->size++; /* XXX "/" fixup. */
rc = dbiGet(dbi, dbcursor, key, data, DB_SET); rc = dbiGet(dbi, dbcursor, key, data, DB_SET);
if (rc > 0) { if (rc > 0) {
rpmError(RPMERR_DBGETINDEX, rpmlog(RPMERR_DBGETINDEX,
_("error(%d) getting \"%s\" records from %s index\n"), _("error(%d) getting \"%s\" records from %s index\n"),
rc, key->data, rpmTagGetName(dbi->dbi_rpmtag)); rc, key->data, rpmTagGetName(dbi->dbi_rpmtag));
} }
@ -1261,7 +1261,7 @@ key->size = strlen(name);
if (rc == DB_NOTFOUND) { /* not found */ if (rc == DB_NOTFOUND) { /* not found */
rc = 0; rc = 0;
} else { /* error */ } else { /* error */
rpmError(RPMERR_DBGETINDEX, rpmlog(RPMERR_DBGETINDEX,
_("error(%d) getting \"%s\" records from %s index\n"), _("error(%d) getting \"%s\" records from %s index\n"),
rc, key->data, rpmTagGetName(dbi->dbi_rpmtag)); rc, key->data, rpmTagGetName(dbi->dbi_rpmtag));
rc = -1; rc = -1;
@ -1311,7 +1311,7 @@ key->size = strlen(name);
if (rc == DB_NOTFOUND) { /* not found */ if (rc == DB_NOTFOUND) { /* not found */
return RPMRC_NOTFOUND; return RPMRC_NOTFOUND;
} else { /* error */ } else { /* error */
rpmError(RPMERR_DBGETINDEX, rpmlog(RPMERR_DBGETINDEX,
_("error(%d) getting \"%s\" records from %s index\n"), _("error(%d) getting \"%s\" records from %s index\n"),
rc, key->data, rpmTagGetName(dbi->dbi_rpmtag)); rc, key->data, rpmTagGetName(dbi->dbi_rpmtag));
return RPMRC_FAIL; return RPMRC_FAIL;
@ -1496,7 +1496,7 @@ static int miFreeHeader(rpmdbMatchIterator mi, dbiIndex dbi)
(void) blockSignals(dbi->dbi_rpmdb, &signalMask); (void) blockSignals(dbi->dbi_rpmdb, &signalMask);
rc = dbiPut(dbi, mi->mi_dbc, key, data, DB_KEYLAST); rc = dbiPut(dbi, mi->mi_dbc, key, data, DB_KEYLAST);
if (rc) { if (rc) {
rpmError(RPMERR_DBPUTINDEX, rpmlog(RPMERR_DBPUTINDEX,
_("error(%d) storing record #%d into %s\n"), _("error(%d) storing record #%d into %s\n"),
rc, mi->mi_prevoffset, rpmTagGetName(dbi->dbi_rpmtag)); rc, mi->mi_prevoffset, rpmTagGetName(dbi->dbi_rpmtag));
} }
@ -1597,7 +1597,7 @@ static int miregexec(miRE mire, const char * val)
char msg[256]; char msg[256];
(void) regerror(rc, mire->preg, msg, sizeof(msg)-1); (void) regerror(rc, mire->preg, msg, sizeof(msg)-1);
msg[sizeof(msg)-1] = '\0'; msg[sizeof(msg)-1] = '\0';
rpmError(RPMERR_REGEXEC, "%s: regexec failed: %s\n", rpmlog(RPMERR_REGEXEC, "%s: regexec failed: %s\n",
mire->pattern, msg); mire->pattern, msg);
rc = -1; rc = -1;
} }
@ -1778,7 +1778,7 @@ int rpmdbSetIteratorRE(rpmdbMatchIterator mi, rpmTag tag,
char msg[256]; char msg[256];
(void) regerror(rc, preg, msg, sizeof(msg)-1); (void) regerror(rc, preg, msg, sizeof(msg)-1);
msg[sizeof(msg)-1] = '\0'; msg[sizeof(msg)-1] = '\0';
rpmError(RPMERR_REGCOMP, "%s: regcomp failed: %s\n", allpat, msg); rpmlog(RPMERR_REGCOMP, "%s: regcomp failed: %s\n", allpat, msg);
} }
break; break;
case RPMMIRE_GLOB: case RPMMIRE_GLOB:
@ -2141,7 +2141,7 @@ if (dbiByteSwapped(dbi) == 1)
mi->mi_h = headerCopyLoad(uh); mi->mi_h = headerCopyLoad(uh);
#endif #endif
if (mi->mi_h == NULL || !headerIsEntry(mi->mi_h, RPMTAG_NAME)) { if (mi->mi_h == NULL || !headerIsEntry(mi->mi_h, RPMTAG_NAME)) {
rpmError(RPMERR_BADHEADER, rpmlog(RPMERR_BADHEADER,
_("rpmdb: damaged header #%u retrieved -- skipping.\n"), _("rpmdb: damaged header #%u retrieved -- skipping.\n"),
mi->mi_offset); mi->mi_offset);
goto top; goto top;
@ -2215,7 +2215,7 @@ static int rpmdbGrowIterator(rpmdbMatchIterator mi, int fpNum)
if (rc) { /* error/not found */ if (rc) { /* error/not found */
if (rc != DB_NOTFOUND) if (rc != DB_NOTFOUND)
rpmError(RPMERR_DBGETINDEX, rpmlog(RPMERR_DBGETINDEX,
_("error(%d) getting \"%s\" records from %s index\n"), _("error(%d) getting \"%s\" records from %s index\n"),
rc, key->data, rpmTagGetName(dbi->dbi_rpmtag)); rc, key->data, rpmTagGetName(dbi->dbi_rpmtag));
#ifdef SQLITE_HACK #ifdef SQLITE_HACK
@ -2334,7 +2334,7 @@ if (key->data && key->size == 0) key->size++; /* XXX "/" fixup. */
rc = dbiGet(dbi, dbcursor, key, data, DB_SET); rc = dbiGet(dbi, dbcursor, key, data, DB_SET);
if (rc > 0) { if (rc > 0) {
rpmError(RPMERR_DBGETINDEX, rpmlog(RPMERR_DBGETINDEX,
_("error(%d) getting \"%s\" records from %s index\n"), _("error(%d) getting \"%s\" records from %s index\n"),
rc, (key->data ? key->data : "???"), rpmTagGetName(dbi->dbi_rpmtag)); rc, (key->data ? key->data : "???"), rpmTagGetName(dbi->dbi_rpmtag));
} }
@ -2436,7 +2436,7 @@ memset(data, 0, sizeof(*data));
} }
if (h == NULL) { if (h == NULL) {
rpmError(RPMERR_DBCORRUPT, _("%s: cannot read header at 0x%x\n"), rpmlog(RPMERR_DBCORRUPT, _("%s: cannot read header at 0x%x\n"),
"rpmdbRemove", hdrNum); "rpmdbRemove", hdrNum);
return 1; return 1;
} }
@ -2493,7 +2493,7 @@ if (dbiByteSwapped(dbi) == 1)
rc = dbiCopen(dbi, dbi->dbi_txnid, &dbcursor, DB_WRITECURSOR); rc = dbiCopen(dbi, dbi->dbi_txnid, &dbcursor, DB_WRITECURSOR);
rc = dbiGet(dbi, dbcursor, key, data, DB_SET); rc = dbiGet(dbi, dbcursor, key, data, DB_SET);
if (rc) { if (rc) {
rpmError(RPMERR_DBGETINDEX, rpmlog(RPMERR_DBGETINDEX,
_("error(%d) setting header #%d record for %s removal\n"), _("error(%d) setting header #%d record for %s removal\n"),
rc, hdrNum, rpmTagGetName(dbi->dbi_rpmtag)); rc, hdrNum, rpmTagGetName(dbi->dbi_rpmtag));
} else } else
@ -2631,7 +2631,7 @@ if (key->size == 0) key->size++; /* XXX "/" fixup. */
} else if (rc == DB_NOTFOUND) { /* not found */ } else if (rc == DB_NOTFOUND) { /* not found */
continue; continue;
} else { /* error */ } else { /* error */
rpmError(RPMERR_DBGETINDEX, rpmlog(RPMERR_DBGETINDEX,
_("error(%d) setting \"%s\" records from %s index\n"), _("error(%d) setting \"%s\" records from %s index\n"),
rc, key->data, rpmTagGetName(dbi->dbi_rpmtag)); rc, key->data, rpmTagGetName(dbi->dbi_rpmtag));
ret += 1; ret += 1;
@ -2650,7 +2650,7 @@ if (key->size == 0) key->size++; /* XXX "/" fixup. */
(void) set2dbt(dbi, data, set); (void) set2dbt(dbi, data, set);
rc = dbiPut(dbi, dbcursor, key, data, DB_KEYLAST); rc = dbiPut(dbi, dbcursor, key, data, DB_KEYLAST);
if (rc) { if (rc) {
rpmError(RPMERR_DBPUTINDEX, rpmlog(RPMERR_DBPUTINDEX,
_("error(%d) storing record \"%s\" into %s\n"), _("error(%d) storing record \"%s\" into %s\n"),
rc, key->data, rpmTagGetName(dbi->dbi_rpmtag)); rc, key->data, rpmTagGetName(dbi->dbi_rpmtag));
ret += 1; ret += 1;
@ -2660,7 +2660,7 @@ if (key->size == 0) key->size++; /* XXX "/" fixup. */
} else { } else {
rc = dbiDel(dbi, dbcursor, key, data, 0); rc = dbiDel(dbi, dbcursor, key, data, 0);
if (rc) { if (rc) {
rpmError(RPMERR_DBPUTINDEX, rpmlog(RPMERR_DBPUTINDEX,
_("error(%d) removing record \"%s\" from %s\n"), _("error(%d) removing record \"%s\" from %s\n"),
rc, key->data, rpmTagGetName(dbi->dbi_rpmtag)); rc, key->data, rpmTagGetName(dbi->dbi_rpmtag));
ret += 1; ret += 1;
@ -2810,7 +2810,7 @@ memset(data, 0, sizeof(*data));
} }
if (ret) { if (ret) {
rpmError(RPMERR_DBCORRUPT, rpmlog(RPMERR_DBCORRUPT,
_("error(%d) allocating new package instance\n"), ret); _("error(%d) allocating new package instance\n"), ret);
goto exit; goto exit;
} }
@ -3046,7 +3046,7 @@ if (key->size == 0) key->size++; /* XXX "/" fixup. */
if (!dbi->dbi_permit_dups) if (!dbi->dbi_permit_dups)
(void) dbt2set(dbi, data, &set); (void) dbt2set(dbi, data, &set);
} else if (rc != DB_NOTFOUND) { /* error */ } else if (rc != DB_NOTFOUND) { /* error */
rpmError(RPMERR_DBGETINDEX, rpmlog(RPMERR_DBGETINDEX,
_("error(%d) getting \"%s\" records from %s index\n"), _("error(%d) getting \"%s\" records from %s index\n"),
rc, key->data, rpmTagGetName(dbi->dbi_rpmtag)); rc, key->data, rpmTagGetName(dbi->dbi_rpmtag));
ret += 1; ret += 1;
@ -3062,7 +3062,7 @@ if (key->size == 0) key->size++; /* XXX "/" fixup. */
rc = dbiPut(dbi, dbcursor, key, data, DB_KEYLAST); rc = dbiPut(dbi, dbcursor, key, data, DB_KEYLAST);
if (rc) { if (rc) {
rpmError(RPMERR_DBPUTINDEX, rpmlog(RPMERR_DBPUTINDEX,
_("error(%d) storing record %s into %s\n"), _("error(%d) storing record %s into %s\n"),
rc, key->data, rpmTagGetName(dbi->dbi_rpmtag)); rc, key->data, rpmTagGetName(dbi->dbi_rpmtag));
ret += 1; ret += 1;
@ -3480,7 +3480,7 @@ int rpmdbRebuild(const char * prefix, rpmts ts,
rootdbpath, newrootdbpath); rootdbpath, newrootdbpath);
if (!access(newrootdbpath, F_OK)) { if (!access(newrootdbpath, F_OK)) {
rpmError(RPMERR_MKDIR, _("temporary database %s already exists\n"), rpmlog(RPMERR_MKDIR, _("temporary database %s already exists\n"),
newrootdbpath); newrootdbpath);
rc = 1; rc = 1;
goto exit; goto exit;
@ -3488,7 +3488,7 @@ int rpmdbRebuild(const char * prefix, rpmts ts,
rpmMessage(RPMMESS_DEBUG, _("creating directory %s\n"), newrootdbpath); rpmMessage(RPMMESS_DEBUG, _("creating directory %s\n"), newrootdbpath);
if (Mkdir(newrootdbpath, 0755)) { if (Mkdir(newrootdbpath, 0755)) {
rpmError(RPMERR_MKDIR, _("creating directory %s: %s\n"), rpmlog(RPMERR_MKDIR, _("creating directory %s: %s\n"),
newrootdbpath, strerror(errno)); newrootdbpath, strerror(errno));
rc = 1; rc = 1;
goto exit; goto exit;
@ -3534,7 +3534,7 @@ int rpmdbRebuild(const char * prefix, rpmts ts,
headerIsEntry(h, RPMTAG_RELEASE) && headerIsEntry(h, RPMTAG_RELEASE) &&
headerIsEntry(h, RPMTAG_BUILDTIME))) headerIsEntry(h, RPMTAG_BUILDTIME)))
{ {
rpmError(RPMERR_INTERNAL, rpmlog(RPMERR_INTERNAL,
_("header #%u in the database is bad -- skipping.\n"), _("header #%u in the database is bad -- skipping.\n"),
_RECNUM); _RECNUM);
continue; continue;
@ -3572,7 +3572,7 @@ int rpmdbRebuild(const char * prefix, rpmts ts,
} }
if (rc) { if (rc) {
rpmError(RPMERR_INTERNAL, rpmlog(RPMERR_INTERNAL,
_("cannot add record originally at %u\n"), _RECNUM); _("cannot add record originally at %u\n"), _RECNUM);
failed = 1; failed = 1;
break; break;

View File

@ -519,7 +519,7 @@ doShellEscape(MacroBuf mb, const char * cmd, size_t clen)
int c; int c;
if (clen >= sizeof(pcmd)) { if (clen >= sizeof(pcmd)) {
rpmError(RPMERR_BADSPEC, _("Target buffer overflow\n")); rpmlog(RPMERR_BADSPEC, _("Target buffer overflow\n"));
return 1; return 1;
} }
@ -578,7 +578,7 @@ doDefine(MacroBuf mb, const char * se, int level, int expandbody)
SKIPBLANK(s, c); SKIPBLANK(s, c);
if (c == '{') { /* XXX permit silent {...} grouping */ if (c == '{') { /* XXX permit silent {...} grouping */
if ((se = matchchar(s, c, '}')) == NULL) { if ((se = matchchar(s, c, '}')) == NULL) {
rpmError(RPMERR_BADSPEC, rpmlog(RPMERR_BADSPEC,
_("Macro %%%s has unterminated body\n"), n); _("Macro %%%s has unterminated body\n"), n);
se = s; /* XXX W2DO? */ se = s; /* XXX W2DO? */
return se; return se;
@ -616,7 +616,7 @@ doDefine(MacroBuf mb, const char * se, int level, int expandbody)
*be = '\0'; *be = '\0';
if (bc || pc) { if (bc || pc) {
rpmError(RPMERR_BADSPEC, rpmlog(RPMERR_BADSPEC,
_("Macro %%%s has unterminated body\n"), n); _("Macro %%%s has unterminated body\n"), n);
se = s; /* XXX W2DO? */ se = s; /* XXX W2DO? */
return se; return se;
@ -635,24 +635,24 @@ doDefine(MacroBuf mb, const char * se, int level, int expandbody)
/* Names must start with alphabetic or _ and be at least 3 chars */ /* Names must start with alphabetic or _ and be at least 3 chars */
if (!((c = *n) && (xisalpha(c) || c == '_') && (ne - n) > 2)) { if (!((c = *n) && (xisalpha(c) || c == '_') && (ne - n) > 2)) {
rpmError(RPMERR_BADSPEC, rpmlog(RPMERR_BADSPEC,
_("Macro %%%s has illegal name (%%define)\n"), n); _("Macro %%%s has illegal name (%%define)\n"), n);
return se; return se;
} }
/* Options must be terminated with ')' */ /* Options must be terminated with ')' */
if (o && oc != ')') { if (o && oc != ')') {
rpmError(RPMERR_BADSPEC, _("Macro %%%s has unterminated opts\n"), n); rpmlog(RPMERR_BADSPEC, _("Macro %%%s has unterminated opts\n"), n);
return se; return se;
} }
if ((be - b) < 1) { if ((be - b) < 1) {
rpmError(RPMERR_BADSPEC, _("Macro %%%s has empty body\n"), n); rpmlog(RPMERR_BADSPEC, _("Macro %%%s has empty body\n"), n);
return se; return se;
} }
if (expandbody && expandU(mb, b, (&buf[sizeof(buf)] - b))) { if (expandbody && expandU(mb, b, (&buf[sizeof(buf)] - b))) {
rpmError(RPMERR_BADSPEC, _("Macro %%%s failed to expand\n"), n); rpmlog(RPMERR_BADSPEC, _("Macro %%%s failed to expand\n"), n);
return se; return se;
} }
@ -683,7 +683,7 @@ doUndefine(rpmMacroContext mc, const char * se)
/* Names must start with alphabetic or _ and be at least 3 chars */ /* Names must start with alphabetic or _ and be at least 3 chars */
if (!((c = *n) && (xisalpha(c) || c == '_') && (ne - n) > 2)) { if (!((c = *n) && (xisalpha(c) || c == '_') && (ne - n) > 2)) {
rpmError(RPMERR_BADSPEC, rpmlog(RPMERR_BADSPEC,
_("Macro %%%s has illegal name (%%undefine)\n"), n); _("Macro %%%s has illegal name (%%undefine)\n"), n);
return se; return se;
} }
@ -784,7 +784,7 @@ freeArgs(MacroBuf mb)
skiptest = 1; /* XXX skip test for %# %* %0 */ skiptest = 1; /* XXX skip test for %# %* %0 */
} else if (!skiptest && me->used <= 0) { } else if (!skiptest && me->used <= 0) {
#if NOTYET #if NOTYET
rpmError(RPMERR_BADSPEC, rpmlog(RPMERR_BADSPEC,
_("Macro %%%s (%s) was not used below level %d\n"), _("Macro %%%s (%s) was not used below level %d\n"),
me->name, me->body, me->level); me->name, me->body, me->level);
#endif #endif
@ -904,7 +904,7 @@ grabArgs(MacroBuf mb, const rpmMacroEntry me, const char * se,
while((c = getopt(argc, (char **)argv, opts)) != -1) while((c = getopt(argc, (char **)argv, opts)) != -1)
{ {
if (c == '?' || (o = strchr(opts, c)) == NULL) { if (c == '?' || (o = strchr(opts, c)) == NULL) {
rpmError(RPMERR_BADSPEC, _("Unknown option %c in %s(%s)\n"), rpmlog(RPMERR_BADSPEC, _("Unknown option %c in %s(%s)\n"),
(char)c, me->name, opts); (char)c, me->name, opts);
return se; return se;
} }
@ -949,7 +949,7 @@ grabArgs(MacroBuf mb, const rpmMacroEntry me, const char * se,
/** /**
* Perform macro message output * Perform macro message output
* @param mb macro expansion state * @param mb macro expansion state
* @param waserror use rpmError()? * @param waserror use rpmlog()?
* @param msg message to ouput * @param msg message to ouput
* @param msglen no. of bytes in message * @param msglen no. of bytes in message
*/ */
@ -959,14 +959,14 @@ doOutput(MacroBuf mb, int waserror, const char * msg, size_t msglen)
char buf[BUFSIZ]; char buf[BUFSIZ];
if (msglen >= sizeof(buf)) { if (msglen >= sizeof(buf)) {
rpmError(RPMERR_BADSPEC, _("Target buffer overflow\n")); rpmlog(RPMERR_BADSPEC, _("Target buffer overflow\n"));
msglen = sizeof(buf) - 1; msglen = sizeof(buf) - 1;
} }
strncpy(buf, msg, msglen); strncpy(buf, msg, msglen);
buf[msglen] = '\0'; buf[msglen] = '\0';
(void) expandU(mb, buf, sizeof(buf)); (void) expandU(mb, buf, sizeof(buf));
if (waserror) if (waserror)
rpmError(RPMERR_BADSPEC, "%s\n", buf); rpmlog(RPMERR_BADSPEC, "%s\n", buf);
else else
fprintf(stderr, "%s", buf); fprintf(stderr, "%s", buf);
} }
@ -990,7 +990,7 @@ doFoo(MacroBuf mb, int negate, const char * f, size_t fn,
buf[0] = '\0'; buf[0] = '\0';
if (g != NULL) { if (g != NULL) {
if (gn >= sizeof(buf)) { if (gn >= sizeof(buf)) {
rpmError(RPMERR_BADSPEC, _("Target buffer overflow\n")); rpmlog(RPMERR_BADSPEC, _("Target buffer overflow\n"));
gn = sizeof(buf) - 1; gn = sizeof(buf) - 1;
} }
strncpy(buf, g, gn); strncpy(buf, g, gn);
@ -1095,7 +1095,7 @@ expandMacro(MacroBuf mb)
int chkexist; int chkexist;
if (++mb->depth > max_macro_depth) { if (++mb->depth > max_macro_depth) {
rpmError(RPMERR_BADSPEC, rpmlog(RPMERR_BADSPEC,
_("Recursion depth(%d) greater than max(%d)\n"), _("Recursion depth(%d) greater than max(%d)\n"),
mb->depth, max_macro_depth); mb->depth, max_macro_depth);
mb->depth--; mb->depth--;
@ -1164,7 +1164,7 @@ expandMacro(MacroBuf mb)
break; break;
case '(': /* %(...) shell escape */ case '(': /* %(...) shell escape */
if ((se = matchchar(s, c, ')')) == NULL) { if ((se = matchchar(s, c, ')')) == NULL) {
rpmError(RPMERR_BADSPEC, rpmlog(RPMERR_BADSPEC,
_("Unterminated %c: %s\n"), (char)c, s); _("Unterminated %c: %s\n"), (char)c, s);
rc = 1; rc = 1;
continue; continue;
@ -1181,7 +1181,7 @@ expandMacro(MacroBuf mb)
break; break;
case '{': /* %{...}/%{...:...} substitution */ case '{': /* %{...}/%{...:...} substitution */
if ((se = matchchar(s, c, '}')) == NULL) { if ((se = matchchar(s, c, '}')) == NULL) {
rpmError(RPMERR_BADSPEC, rpmlog(RPMERR_BADSPEC,
_("Unterminated %c: %s\n"), (char)c, s); _("Unterminated %c: %s\n"), (char)c, s);
rc = 1; rc = 1;
continue; continue;
@ -1222,7 +1222,7 @@ expandMacro(MacroBuf mb)
c = '%'; /* XXX only need to save % */ c = '%'; /* XXX only need to save % */
SAVECHAR(mb, c); SAVECHAR(mb, c);
#if 0 #if 0
rpmError(RPMERR_BADSPEC, rpmlog(RPMERR_BADSPEC,
_("A %% is followed by an unparseable macro\n")); _("A %% is followed by an unparseable macro\n"));
#endif #endif
s = se; s = se;
@ -1378,7 +1378,7 @@ expandMacro(MacroBuf mb)
c = '%'; /* XXX only need to save % */ c = '%'; /* XXX only need to save % */
SAVECHAR(mb, c); SAVECHAR(mb, c);
#else #else
rpmError(RPMERR_BADSPEC, rpmlog(RPMERR_BADSPEC,
_("Macro %%%.*s not found, skipping\n"), fn, f); _("Macro %%%.*s not found, skipping\n"), fn, f);
s = se; s = se;
#endif #endif
@ -1695,7 +1695,7 @@ expandMacros(void * spec, rpmMacroContext mc, char * sbuf, size_t slen)
rc = expandMacro(mb); rc = expandMacro(mb);
if (mb->nb == 0) if (mb->nb == 0)
rpmError(RPMERR_BADSPEC, _("Target buffer overflow\n")); rpmlog(RPMERR_BADSPEC, _("Target buffer overflow\n"));
tbuf[slen] = '\0'; /* XXX just in case */ tbuf[slen] = '\0'; /* XXX just in case */
strncpy(sbuf, tbuf, (slen - mb->nb + 1)); strncpy(sbuf, tbuf, (slen - mb->nb + 1));
@ -1898,16 +1898,16 @@ int isCompressed(const char * file, rpmCompressedMagic * compressed)
fd = Fopen(file, "r.ufdio"); fd = Fopen(file, "r.ufdio");
if (fd == NULL || Ferror(fd)) { if (fd == NULL || Ferror(fd)) {
/* XXX Fstrerror */ /* XXX Fstrerror */
rpmError(RPMERR_BADSPEC, _("File %s: %s\n"), file, Fstrerror(fd)); rpmlog(RPMERR_BADSPEC, _("File %s: %s\n"), file, Fstrerror(fd));
if (fd) (void) Fclose(fd); if (fd) (void) Fclose(fd);
return 1; return 1;
} }
nb = Fread(magic, sizeof(magic[0]), sizeof(magic), fd); nb = Fread(magic, sizeof(magic[0]), sizeof(magic), fd);
if (nb < 0) { if (nb < 0) {
rpmError(RPMERR_BADSPEC, _("File %s: %s\n"), file, Fstrerror(fd)); rpmlog(RPMERR_BADSPEC, _("File %s: %s\n"), file, Fstrerror(fd));
rc = 1; rc = 1;
} else if (nb < sizeof(magic)) { } else if (nb < sizeof(magic)) {
rpmError(RPMERR_BADSPEC, _("File %s is smaller than %u bytes\n"), rpmlog(RPMERR_BADSPEC, _("File %s is smaller than %u bytes\n"),
file, (unsigned)sizeof(magic)); file, (unsigned)sizeof(magic));
rc = 0; rc = 0;
} }

View File

@ -810,7 +810,7 @@ static FD_t urlOpen(const char * url, int flags, mode_t mode)
wait = waitpid(pid, &rc, 0); wait = waitpid(pid, &rc, 0);
if (!WIFEXITED(rc) || WEXITSTATUS(rc)) { if (!WIFEXITED(rc) || WEXITSTATUS(rc)) {
rpmError(RPMERR_EXEC, _("URL helper failed: %s (%d)\n"), rpmlog(RPMERR_EXEC, _("URL helper failed: %s (%d)\n"),
cmd, WEXITSTATUS(rc)); cmd, WEXITSTATUS(rc));
} else { } else {
fd = fdOpen(dest, flags, mode); fd = fdOpen(dest, flags, mode);

View File

@ -446,7 +446,7 @@ int rpmluaCheckScript(rpmlua _lua, const char *script, const char *name)
if (name == NULL) if (name == NULL)
name = "<lua>"; name = "<lua>";
if (luaL_loadbuffer(L, script, strlen(script), name) != 0) { if (luaL_loadbuffer(L, script, strlen(script), name) != 0) {
rpmError(RPMERR_SCRIPT, rpmlog(RPMERR_SCRIPT,
_("invalid syntax in lua scriptlet: %s\n"), _("invalid syntax in lua scriptlet: %s\n"),
lua_tostring(L, -1)); lua_tostring(L, -1));
ret = -1; ret = -1;
@ -463,12 +463,12 @@ int rpmluaRunScript(rpmlua _lua, const char *script, const char *name)
if (name == NULL) if (name == NULL)
name = "<lua>"; name = "<lua>";
if (luaL_loadbuffer(L, script, strlen(script), name) != 0) { if (luaL_loadbuffer(L, script, strlen(script), name) != 0) {
rpmError(RPMERR_SCRIPT, _("invalid syntax in lua script: %s\n"), rpmlog(RPMERR_SCRIPT, _("invalid syntax in lua script: %s\n"),
lua_tostring(L, -1)); lua_tostring(L, -1));
lua_pop(L, 1); lua_pop(L, 1);
ret = -1; ret = -1;
} else if (lua_pcall(L, 0, 0, 0) != 0) { } else if (lua_pcall(L, 0, 0, 0) != 0) {
rpmError(RPMERR_SCRIPT, _("lua script failed: %s\n"), rpmlog(RPMERR_SCRIPT, _("lua script failed: %s\n"),
lua_tostring(L, -1)); lua_tostring(L, -1));
lua_pop(L, 1); lua_pop(L, 1);
ret = -1; ret = -1;
@ -482,12 +482,12 @@ int rpmluaRunScriptFile(rpmlua _lua, const char *filename)
lua_State *L = lua->L; lua_State *L = lua->L;
int ret = 0; int ret = 0;
if (luaL_loadfile(L, filename) != 0) { if (luaL_loadfile(L, filename) != 0) {
rpmError(RPMERR_SCRIPT, _("invalid syntax in lua file: %s\n"), rpmlog(RPMERR_SCRIPT, _("invalid syntax in lua file: %s\n"),
lua_tostring(L, -1)); lua_tostring(L, -1));
lua_pop(L, 1); lua_pop(L, 1);
ret = -1; ret = -1;
} else if (lua_pcall(L, 0, 0, 0) != 0) { } else if (lua_pcall(L, 0, 0, 0) != 0) {
rpmError(RPMERR_SCRIPT, _("lua script failed: %s\n"), rpmlog(RPMERR_SCRIPT, _("lua script failed: %s\n"),
lua_tostring(L, -1)); lua_tostring(L, -1));
lua_pop(L, 1); lua_pop(L, 1);
ret = -1; ret = -1;
@ -617,7 +617,7 @@ static int rpmluaHookWrapper(rpmhookArgs args, void *data)
} }
} }
if (lua_pcall(L, 1, 1, 0) != 0) { if (lua_pcall(L, 1, 1, 0) != 0) {
rpmError(RPMERR_SCRIPT, _("lua hook failed: %s\n"), rpmlog(RPMERR_SCRIPT, _("lua hook failed: %s\n"),
lua_tostring(L, -1)); lua_tostring(L, -1));
lua_pop(L, 1); lua_pop(L, 1);
} else { } else {

View File

@ -116,7 +116,7 @@ restart:
/* Try to read the header from a package file. */ /* Try to read the header from a package file. */
fd = Fopen(*fnp, "r.ufdio"); fd = Fopen(*fnp, "r.ufdio");
if (fd == NULL || Ferror(fd)) { if (fd == NULL || Ferror(fd)) {
rpmError(RPMERR_OPEN, _("open of %s failed: %s\n"), *fnp, rpmlog(RPMERR_OPEN, _("open of %s failed: %s\n"), *fnp,
Fstrerror(fd)); Fstrerror(fd));
if (fd) { if (fd) {
Fclose(fd); Fclose(fd);
@ -153,7 +153,7 @@ maybe_manifest:
/* Try to read a package manifest. */ /* Try to read a package manifest. */
fd = Fopen(*fnp, "r.fpio"); fd = Fopen(*fnp, "r.fpio");
if (fd == NULL || Ferror(fd)) { if (fd == NULL || Ferror(fd)) {
rpmError(RPMERR_OPEN, _("open of %s failed: %s\n"), *fnp, rpmlog(RPMERR_OPEN, _("open of %s failed: %s\n"), *fnp,
Fstrerror(fd)); Fstrerror(fd));
if (fd) { if (fd) {
Fclose(fd); Fclose(fd);
@ -166,7 +166,7 @@ maybe_manifest:
/* Read list of packages from manifest. */ /* Read list of packages from manifest. */
rc = rpmReadPackageManifest(fd, &argc, &argv); rc = rpmReadPackageManifest(fd, &argc, &argv);
if (rc) if (rc)
rpmError(RPMERR_MANIFEST, _("%s: read manifest failed: %s\n"), rpmlog(RPMERR_MANIFEST, _("%s: read manifest failed: %s\n"),
fileURL, Fstrerror(fd)); fileURL, Fstrerror(fd));
Fclose(fd); Fclose(fd);
fd = NULL; fd = NULL;