if (errfd != NULL) {
if (rpmIsVerbose()) {
- out = errfd;
+ out = fdDup(fdFileno(errfd));
} else {
out = fdOpen("/dev/null", O_WRONLY, 0);
- if (fdFileno(out) < 0) {
- out = errfd;
- }
+ if (fdFileno(out) < 0)
+ out = fdDup(fdFileno(errfd));
}
} else {
out = fdDup(STDOUT_FILENO);
if (freePrefixes) free(prefixes);
fdClose(out); /* XXX dup'd STDOUT_FILENO */
- if (errfd != NULL) {
- if (fdFileno(errfd) > STDERR_FILENO) fdClose(errfd);
- }
if (script) {
if (!rpmIsDebug()) unlink(fn);
#include "url.h"
#include "verify.h"
-static int verifyHeader(char * prefix, Header h, int verifyFlags);
-static int verifyMatches(char * prefix, rpmdb db, dbiIndexSet matches,
+static int verifyHeader(const char * prefix, Header h, int verifyFlags);
+static int verifyMatches(const char * prefix, rpmdb db, dbiIndexSet matches,
int verifyFlags);
static int verifyDependencies(rpmdb db, Header h);
-static int verifyHeader(char * prefix, Header h, int verifyFlags) {
- char ** fileList;
+static int verifyHeader(const char * prefix, Header h, int verifyFlags) {
+ const char ** fileList;
int count, type;
int verifyResult;
int i, ec, rc;
rpmTransactionSet rpmdep;
struct rpmDependencyConflict * conflicts;
int numConflicts;
- char * name, * version, * release;
+ const char * name, * version, * release;
int type, count, i;
rpmdep = rpmtransCreateSet(db, NULL);
return 0;
}
-static int verifyPackage(char * root, rpmdb db, Header h, int verifyFlags) {
+static int verifyPackage(const char * root, rpmdb db, Header h, int verifyFlags) {
int ec, rc;
FD_t fdo;
ec = 0;
return ec;
}
-static int verifyMatches(char * prefix, rpmdb db, dbiIndexSet matches,
+static int verifyMatches(const char * prefix, rpmdb db, dbiIndexSet matches,
int verifyFlags) {
int ec, rc;
int i;
return ec;
}
-int doVerify(char * prefix, enum verifysources source, char ** argv,
+int doVerify(const char * prefix, enum verifysources source, const char ** argv,
int verifyFlags) {
Header h;
int offset;
int isSource;
rpmdb db;
dbiIndexSet matches;
- char * arg;
ec = 0;
if (source == VERIFY_RPM && !(verifyFlags & VERIFY_DEPS)) {
fprintf(stderr, _("could not read database record!\n"));
return 1; /* XXX was exit(EXIT_FAILURE) */
}
+
if ((rc = verifyPackage(prefix, db, h, verifyFlags)) != 0)
ec = rc;
headerFree(h);
}
} else {
while (*argv) {
- arg = *argv++;
+ const char *arg = *argv++;
rc = 0;
switch (source) {
enum verifysources { VERIFY_PATH, VERIFY_PACKAGE, VERIFY_EVERY, VERIFY_RPM,
VERIFY_GRP, };
-int doVerify(char * prefix, enum verifysources source, char ** argv,
+int doVerify(const char * prefix, enum verifysources source, const char ** argv,
int verifyFlags);
#endif