diff options
-rw-r--r-- | CHANGES | 1 | ||||
-rw-r--r-- | build.c | 52 | ||||
-rw-r--r-- | build.h | 6 | ||||
-rw-r--r-- | build/build.c | 4 | ||||
-rw-r--r-- | build/pack.c | 17 | ||||
-rw-r--r-- | build/parseSpec.c | 4 | ||||
-rw-r--r-- | build/reqprov.c | 6 | ||||
-rw-r--r-- | build/rpmbuild.h | 8 | ||||
-rw-r--r-- | checksig.c | 26 | ||||
-rw-r--r-- | install.c | 64 | ||||
-rw-r--r-- | install.h | 8 | ||||
-rw-r--r-- | lib/dbindex.c | 18 | ||||
-rw-r--r-- | lib/dbindex.h | 6 | ||||
-rw-r--r-- | lib/depends.c | 15 | ||||
-rw-r--r-- | lib/depends.h | 2 | ||||
-rw-r--r-- | lib/formats.c | 6 | ||||
-rw-r--r-- | lib/fprint.c | 19 | ||||
-rw-r--r-- | lib/fprint.h | 8 | ||||
-rw-r--r-- | lib/fs.c | 13 | ||||
-rw-r--r-- | lib/install.c | 18 | ||||
-rw-r--r-- | lib/install.h | 8 | ||||
-rw-r--r-- | lib/lookup.c | 2 | ||||
-rw-r--r-- | lib/misc.c | 41 | ||||
-rw-r--r-- | lib/misc.h | 10 | ||||
-rw-r--r-- | lib/query.c | 14 | ||||
-rw-r--r-- | lib/rebuilddb.c | 37 | ||||
-rw-r--r-- | lib/rpmdb.c | 56 | ||||
-rw-r--r-- | lib/rpmdb.h | 6 | ||||
-rw-r--r-- | lib/rpmlib.h | 40 | ||||
-rw-r--r-- | lib/signature.c | 30 | ||||
-rw-r--r-- | lib/signature.h | 6 | ||||
-rw-r--r-- | lib/uninstall.c | 51 | ||||
-rw-r--r-- | lib/verify.c | 4 | ||||
-rw-r--r-- | po/rpm.pot | 253 | ||||
-rw-r--r-- | popt/po/popt.pot | 2 | ||||
-rwxr-xr-x | rpm.c | 8 |
36 files changed, 459 insertions, 410 deletions
@@ -38,6 +38,7 @@ - there must be a { between two % in a query format (unless %% is used) 2.5.6 -> 2.5.7: + - propagate "const char *" into rpmlib prototypes. - use "original db-1.85" if available (Raw Hide glibc 2.1). - make sure files to sign exist before asking for the pass phrase @@ -10,13 +10,13 @@ int buildForTarget(char *arg, int buildAmount, char *passPhrase, force); #endif -static int buildForTarget(char *arg, int buildAmount, char *passPhrase, - char *buildRoot, int fromTarball, int test, char *cookie, +static int buildForTarget(const char *arg, int buildAmount, const char *passPhrase, + const char *buildRoot, int fromTarball, int test, char *cookie, int force) { FILE *f; - char * specfile; + const char * specfile; int res = 0; struct stat statbuf; char * s; @@ -29,7 +29,7 @@ static int buildForTarget(char *arg, int buildAmount, char *passPhrase, if (fromTarball) { const char *specDir; const char * tmpSpecFile; - char * cmd; + char * cmd, *s; char tfn[64]; specDir = rpmGetPath("%{_specdir}", NULL); @@ -43,6 +43,8 @@ static int buildForTarget(char *arg, int buildAmount, char *passPhrase, if (!(f = popen(cmd, "r"))) { fprintf(stderr, _("Failed to open tar pipe: %s\n"), strerror(errno)); + xfree(specDir); + xfree(tmpSpecFile); return 1; } if ((!fgets(buf, sizeof(buf) - 1, f)) || !strchr(buf, '/')) { @@ -54,36 +56,42 @@ static int buildForTarget(char *arg, int buildAmount, char *passPhrase, if (!(f = popen(cmd, "r"))) { fprintf(stderr, _("Failed to open tar pipe: %s\n"), strerror(errno)); + xfree(specDir); + xfree(tmpSpecFile); return 1; } if (!fgets(buf, sizeof(buf) - 1, f)) { /* Give up */ fprintf(stderr, _("Failed to read spec file from %s\n"), arg); unlink(tmpSpecFile); - return 1; + xfree(specDir); + xfree(tmpSpecFile); + return 1; } } pclose(f); - cmd = specfile = buf; + cmd = s = buf; while (*cmd) { - if (*cmd == '/') specfile = cmd + 1; + if (*cmd == '/') s = cmd + 1; cmd++; } - cmd = specfile; + cmd = s; /* remove trailing \n */ - specfile = cmd + strlen(cmd) - 1; - *specfile = '\0'; + s = cmd + strlen(cmd) - 1; + *s = '\0'; - specfile = alloca(strlen(specDir) + strlen(cmd) + 5); - sprintf(specfile, "%s/%s", specDir, cmd); + s = alloca(strlen(specDir) + strlen(cmd) + 5); + sprintf(s, "%s/%s", specDir, cmd); - if (rename(tmpSpecFile, specfile)) { + if (rename(tmpSpecFile, s)) { fprintf(stderr, _("Failed to rename %s to %s: %s\n"), - tmpSpecFile, specfile, strerror(errno)); + tmpSpecFile, s, strerror(errno)); unlink(tmpSpecFile); + xfree(specDir); + xfree(tmpSpecFile); return 1; } @@ -104,13 +112,15 @@ static int buildForTarget(char *arg, int buildAmount, char *passPhrase, addMacro(&globalMacroContext, "_sourcedir", NULL, buf, RMIL_TARBALL); xfree(specDir); xfree(tmpSpecFile); + specfile = s; } else if (arg[0] == '/') { specfile = arg; } else { - specfile = alloca(BUFSIZ); - (void)getcwd(specfile, BUFSIZ); - strcat(specfile, "/"); - strcat(specfile, arg); + char *s = alloca(BUFSIZ); + (void)getcwd(s, BUFSIZ); + strcat(s, "/"); + strcat(s, arg); + specfile = s; } stat(specfile, &statbuf); @@ -155,9 +165,9 @@ static int buildForTarget(char *arg, int buildAmount, char *passPhrase, return res; } -int build(char *arg, int buildAmount, char *passPhrase, - char *buildRoot, int fromTarball, int test, char *cookie, - char * rcfile, char *targets, int force) +int build(const char *arg, int buildAmount, const char *passPhrase, + const char *buildRoot, int fromTarball, int test, char *cookie, + const char * rcfile, char *targets, int force) { char *target, *t; int rc; @@ -18,9 +18,9 @@ struct rpmBuildArguments { char buildChar; }; -int build(char *arg, int buildAmount, char *passPhrase, - char *buildRoot, int fromTarball, int test, char *cookie, - char * rcfile, char * buildplatforms, int force); +int build(const char *arg, int buildAmount, const char *passPhrase, + const char *buildRoot, int fromTarball, int test, char *cookie, + const char * rcfile, char * buildplatforms, int force); #ifdef __cplusplus } diff --git a/build/build.c b/build/build.c index e3c486b67..f628e0b4b 100644 --- a/build/build.c +++ b/build/build.c @@ -43,11 +43,11 @@ static char *_preScriptChdir = "cd %{_builddir}\n" ; -int doScript(Spec spec, int what, char *name, StringBuf sb, int test) +int doScript(Spec spec, int what, const char *name, StringBuf sb, int test) { FD_t fd; FILE *f; - char *scriptName; + const char *scriptName; int pid; int status; char *buildShell; diff --git a/build/pack.c b/build/pack.c index eb9e8bc14..5b49a7e60 100644 --- a/build/pack.c +++ b/build/pack.c @@ -238,7 +238,8 @@ int writeRPM(Header header, const char *fileName, int type, FD_t fd, ifd; int rc, count, sigtype; int archnum, osnum; - char *sigtarget, *name, *version, *release; + const char *sigtarget; + char *name, *version, *release; char buf[BUFSIZ]; Header sig; struct rpmlead lead; @@ -276,7 +277,7 @@ int writeRPM(Header header, const char *fileName, int type, if (rc != 0) { fdClose(fd); unlink(sigtarget); - free(sigtarget); + xfree(sigtarget); return rc; } @@ -295,7 +296,7 @@ int writeRPM(Header header, const char *fileName, int type, if (fdFileno(fd = fdOpen(fileName, O_WRONLY|O_CREAT|O_TRUNC, 0644)) < 0) { rpmError(RPMERR_CREATE, _("Could not open %s\n"), fileName); unlink(sigtarget); - free(sigtarget); + xfree(sigtarget); return RPMERR_CREATE; } @@ -329,7 +330,7 @@ int writeRPM(Header header, const char *fileName, int type, strerror(errno)); fdClose(fd); unlink(sigtarget); - free(sigtarget); + xfree(sigtarget); unlink(fileName); return rc; } @@ -347,7 +348,7 @@ int writeRPM(Header header, const char *fileName, int type, if ((rc = rpmWriteSignature(fd, sig))) { fdClose(fd); unlink(sigtarget); - free(sigtarget); + xfree(sigtarget); unlink(fileName); rpmFreeSignature(sig); return rc; @@ -363,7 +364,7 @@ int writeRPM(Header header, const char *fileName, int type, fdClose(ifd); fdClose(fd); unlink(sigtarget); - free(sigtarget); + xfree(sigtarget); unlink(fileName); return RPMERR_READERROR; } @@ -373,7 +374,7 @@ int writeRPM(Header header, const char *fileName, int type, fdClose(ifd); fdClose(fd); unlink(sigtarget); - free(sigtarget); + xfree(sigtarget); unlink(fileName); return RPMERR_NOSPACE; } @@ -381,7 +382,7 @@ int writeRPM(Header header, const char *fileName, int type, fdClose(ifd); fdClose(fd); unlink(sigtarget); - free(sigtarget); + xfree(sigtarget); rpmMessage(RPMMESS_NORMAL, _("Wrote: %s\n"), fileName); diff --git a/build/parseSpec.c b/build/parseSpec.c index 7727ac9dd..4118156fe 100644 --- a/build/parseSpec.c +++ b/build/parseSpec.c @@ -276,8 +276,8 @@ void closeSpec(Spec spec) int noLang = 0; /* XXX FIXME: pass as arg */ -int parseSpec(Spec *specp, char *specFile, char *buildRoot, - int inBuildArch, char *passPhrase, char *cookie, +int parseSpec(Spec *specp, const char *specFile, const char *buildRoot, + int inBuildArch, const char *passPhrase, char *cookie, int anyarch, int force) { int parsePart = PART_PREAMBLE; diff --git a/build/reqprov.c b/build/reqprov.c index 19745c521..3ed4ad4ce 100644 --- a/build/reqprov.c +++ b/build/reqprov.c @@ -5,10 +5,10 @@ #include "rpmbuild.h" int addReqProv(Spec spec, Package pkg, - int flag, char *name, char *version, int index) + int flag, const char *name, const char *version, int index) { - char **names; - char **versions = NULL; + const char **names; + const char **versions = NULL; int *flags = NULL; int *indexes = NULL; int nametag = 0; diff --git a/build/rpmbuild.h b/build/rpmbuild.h index aebbc0e77..a8d03ead3 100644 --- a/build/rpmbuild.h +++ b/build/rpmbuild.h @@ -117,7 +117,7 @@ char *parseExpressionString(Spec, char *); /* from build/build.h */ -int doScript(Spec spec, int what, char *name, StringBuf sb, int test); +int doScript(Spec spec, int what, const char *name, StringBuf sb, int test); /* from build/package.h */ @@ -129,7 +129,7 @@ void freePackage(/*@only@*/ Package p); /* from build/reqprov.h */ int addReqProv(Spec spec, Package pkg, - int flag, char *name, char *version, int index); + int flag, const char *name, const char *version, int index); /* from build/files.h */ @@ -138,8 +138,8 @@ int processSourceFiles(Spec spec); /* global entry points */ -int parseSpec(Spec *specp, char *specFile, char *buildRoot, - int inBuildArch, char *passPhrase, char *cookie, int anyarch, +int parseSpec(Spec *specp, const char *specFile, const char *buildRoot, + int inBuildArch, const char *passPhrase, char *cookie, int anyarch, int force); int buildSpec(Spec spec, int what, int test); diff --git a/checksig.c b/checksig.c index 25403fb14..7bb8d8447 100644 --- a/checksig.c +++ b/checksig.c @@ -14,7 +14,8 @@ int doReSign(int add, char *passPhrase, char **argv) int count; struct rpmlead lead; unsigned short sigtype; - char *rpm, *sigtarget; + char *rpm; + const char *sigtarget; char tmprpm[1024]; unsigned char buffer[8192]; Header sig; @@ -55,14 +56,14 @@ int doReSign(int add, char *passPhrase, char **argv) perror(_("Couldn't read the header/archive")); fdClose(ofd); unlink(sigtarget); - free(sigtarget); + xfree(sigtarget); exit(EXIT_FAILURE); } if (fdWrite(ofd, buffer, count) < 0) { perror(_("Couldn't write header/archive to temp file")); fdClose(ofd); unlink(sigtarget); - free(sigtarget); + xfree(sigtarget); exit(EXIT_FAILURE); } } @@ -78,7 +79,7 @@ int doReSign(int add, char *passPhrase, char **argv) fdClose(ofd); unlink(sigtarget); unlink(tmprpm); - free(sigtarget); + xfree(sigtarget); exit(EXIT_FAILURE); } @@ -97,7 +98,7 @@ int doReSign(int add, char *passPhrase, char **argv) fdClose(ofd); unlink(sigtarget); unlink(tmprpm); - free(sigtarget); + xfree(sigtarget); rpmFreeSignature(sig); exit(EXIT_FAILURE); } @@ -112,7 +113,7 @@ int doReSign(int add, char *passPhrase, char **argv) fdClose(fd); unlink(sigtarget); unlink(tmprpm); - free(sigtarget); + xfree(sigtarget); exit(EXIT_FAILURE); } if (fdWrite(ofd, buffer, count) < 0) { @@ -121,14 +122,14 @@ int doReSign(int add, char *passPhrase, char **argv) fdClose(fd); unlink(sigtarget); unlink(tmprpm); - free(sigtarget); + xfree(sigtarget); exit(EXIT_FAILURE); } } fdClose(fd); fdClose(ofd); unlink(sigtarget); - free(sigtarget); + xfree(sigtarget); /* Move it in to place */ unlink(rpm); @@ -144,7 +145,8 @@ int doCheckSig(int flags, char **argv) int res, res2, res3, missingKeys; struct rpmlead lead; char *rpm; - char result[1024], * sigtarget; + char result[1024]; + const char * sigtarget; unsigned char buffer[8192]; Header sig; HeaderIterator sigIter; @@ -187,7 +189,7 @@ int doCheckSig(int flags, char **argv) perror(_("Couldn't read the header/archive")); fdClose(ofd); unlink(sigtarget); - free(sigtarget); + xfree(sigtarget); exit(EXIT_FAILURE); } if (fdWrite(ofd, buffer, count) < 0) { @@ -195,7 +197,7 @@ int doCheckSig(int flags, char **argv) perror(""); fdClose(ofd); unlink(sigtarget); - free(sigtarget); + xfree(sigtarget); exit(EXIT_FAILURE); } } @@ -276,7 +278,7 @@ int doCheckSig(int flags, char **argv) headerFreeIterator(sigIter); res += res2; unlink(sigtarget); - free(sigtarget); + xfree(sigtarget); if (res2) { if (rpmIsVerbose()) { @@ -65,15 +65,15 @@ static void showProgress(const Header h, const rpmNotifyType what, } } -int doInstall(char * rootdir, char ** argv, int installFlags, +int doInstall(const char * rootdir, const char ** argv, int installFlags, int interfaceFlags, int probFilter, rpmRelocation * relocations) { rpmdb db = NULL; FD_t fd; int i; int mode, rc, major; - char ** packages, ** tmpPackages; - char ** filename; + const char ** packages, ** tmpPackages; + const char ** filename; int numPackages; int numTmpPackages = 0, numBinaryPackages = 0, numSourcePackages = 0; int numFailed = 0; @@ -155,8 +155,10 @@ int doInstall(char * rootdir, char ** argv, int installFlags, would create all sorts of confusion later. */ rpmMessage(RPMMESS_DEBUG, _("opening database mode: 0%o\n"), mode); if (rpmdbOpen(rootdir, &db, mode, 0644)) { - fprintf(stderr, _("error: cannot open %s%s/packages.rpm\n"), - rootdir, rpmGetVar(RPMVAR_DBPATH)); + const char *dn; + dn = rpmGetPath( (rootdir ? rootdir : ""), "%{_dbpath}", NULL); + rpmMessage(RPMMESS_ERROR, _("cannot open %s/packages.rpm\n"), dn); + xfree(dn); exit(EXIT_FAILURE); } @@ -173,22 +175,28 @@ int doInstall(char * rootdir, char ** argv, int installFlags, rc = rpmReadPackageHeader(fd, &h, &isSource, &major, NULL); - if (rc == 1) { + switch (rc) { + case 1: fdClose(fd); - fprintf(stderr, - _("error: %s does not appear to be a RPM package\n"), - *filename); - } else if (rc) { - fprintf(stderr, _("error: %s cannot be installed\n"), *filename); + rpmMessage(RPMMESS_ERROR, + _("%s does not appear to be a RPM package\n"), + *filename); + break; + default: + rpmMessage(RPMMESS_ERROR, _("%s cannot be installed\n"), *filename); numFailed++; packages[i] = NULL; - } else if (isSource && major == 1) { - printf("XXX FIXME I can't install v1 source packages!!!\n"); - } else { - rpmtransAddPackage(rpmdep, h, fd, + break; + case 0: + if (isSource && major == 1) { + printf("XXX FIXME I can't install v1 source packages!!!\n"); + } else { + rpmtransAddPackage(rpmdep, h, fd, packages[i], (interfaceFlags & INSTALL_UPGRADE) != 0, relocations); + } + break; } } @@ -236,7 +244,7 @@ int doInstall(char * rootdir, char ** argv, int installFlags, numFailed += rc; for (i = 0; i < finalProbs->numProblems; i++) if (!finalProbs->probs[i].ignoreProblem) - fprintf(stderr, "error: %s\n", + rpmMessage(RPMMESS_ERROR, "%s\n", rpmProblemString(finalProbs->probs[i])); rpmProblemSetFree(finalProbs); @@ -258,7 +266,7 @@ int doInstall(char * rootdir, char ** argv, int installFlags, return numFailed; } -int doUninstall(char * rootdir, char ** argv, int uninstallFlags, +int doUninstall(const char * rootdir, const char ** argv, int uninstallFlags, int interfaceFlags) { rpmdb db; dbiIndexSet matches; @@ -266,7 +274,7 @@ int doUninstall(char * rootdir, char ** argv, int uninstallFlags, int mode; int rc; int count; - char ** arg; + const char ** arg; int numFailed = 0; rpmTransactionSet rpmdep; struct rpmDependencyConflict * conflicts; @@ -285,8 +293,10 @@ int doUninstall(char * rootdir, char ** argv, int uninstallFlags, mode = O_RDWR | O_EXCL; if (rpmdbOpen(rootdir, &db, mode, 0644)) { - rpmMessage(RPMMESS_ERROR, _("cannot open %s%s/packages.rpm\n"), - rootdir, rpmGetVar(RPMVAR_DBPATH)); + const char *dn; + dn = rpmGetPath( (rootdir ? rootdir : ""), "%{_dbpath}", NULL); + rpmMessage(RPMMESS_ERROR, _("cannot open %s/packages.rpm\n"), dn); + xfree(dn); exit(EXIT_FAILURE); } @@ -294,13 +304,16 @@ int doUninstall(char * rootdir, char ** argv, int uninstallFlags, rpmdep = rpmtransCreateSet(db, rootdir); for (arg = argv; *arg; arg++) { rc = rpmdbFindByLabel(db, *arg, &matches); - if (rc == 1) { + switch (rc) { + case 1: rpmMessage(RPMMESS_ERROR, _("package %s is not installed\n"), *arg); numFailed++; - } else if (rc == 2) { + break; + case 2: rpmMessage(RPMMESS_ERROR, _("searching for package %s\n"), *arg); numFailed++; - } else { + break; + default: count = 0; for (i = 0; i < dbiIndexSetCount(matches); i++) if (dbiIndexRecordOffset(matches, i)) count++; @@ -321,6 +334,7 @@ int doUninstall(char * rootdir, char ** argv, int uninstallFlags, } dbiFreeIndexRecord(matches); + break; } } @@ -351,7 +365,7 @@ int doUninstall(char * rootdir, char ** argv, int uninstallFlags, return numFailed; } -int doSourceInstall(char * rootdir, char * arg, char ** specFile, +int doSourceInstall(const char * rootdir, const char * arg, const char ** specFile, char ** cookie) { FD_t fd; int rc; @@ -378,7 +392,7 @@ int doSourceInstall(char * rootdir, char * arg, char ** specFile, return rc; } -void printDepFlags(FILE * f, char * version, int flags) { +void printDepFlags(FILE * f, const char * version, int flags) { if (flags) fprintf(f, " "); @@ -13,13 +13,13 @@ #define UNINSTALL_NODEPS (1 << 0) #define UNINSTALL_ALLMATCHES (1 << 1) -int doInstall(char * rootdir, char ** argv, int installFlags, +int doInstall(const char * rootdir, const char ** argv, int installFlags, int interfaceFlags, int probFilter, rpmRelocation * relocations); -int doSourceInstall(char * prefix, char * arg, char ** specFile, +int doSourceInstall(const char * prefix, const char * arg, const char ** specFile, char ** cookie); -int doUninstall(char * rootdir, char ** argv, int uninstallFlags, +int doUninstall(const char * rootdir, const char ** argv, int uninstallFlags, int interfaceFlags); -void printDepFlags(FILE * f, char * version, int flags); +void printDepFlags(FILE * f, const char * version, int flags); #endif diff --git a/lib/dbindex.c b/lib/dbindex.c index 6489d12ee..1b64ccf58 100644 --- a/lib/dbindex.c +++ b/lib/dbindex.c @@ -29,7 +29,7 @@ void dbiSyncIndex(dbiIndex * dbi) { dbi->db->sync(dbi->db, 0); } -int dbiGetFirstKey(dbiIndex * dbi, char ** keyp) { +int dbiGetFirstKey(dbiIndex * dbi, const char ** keyp) { DBT key, data; int rc; @@ -38,18 +38,20 @@ int dbiGetFirstKey(dbiIndex * dbi, char ** keyp) { return 1; } - *keyp = malloc(key.size + 1); - memcpy(*keyp, key.data, key.size); - (*keyp)[key.size] = '\0'; + { char *k = malloc(key.size + 1); + memcpy(k, key.data, key.size); + k[key.size] = '\0'; + *keyp = k; + } return 0; } -int dbiSearchIndex(dbiIndex * dbi, char * str, dbiIndexSet * set) { +int dbiSearchIndex(dbiIndex * dbi, const char * str, dbiIndexSet * set) { DBT key, data; int rc; - key.data = str; + key.data = (void *)str; key.size = strlen(str); rc = dbi->db->get(dbi->db, &key, &data, 0); @@ -68,12 +70,12 @@ int dbiSearchIndex(dbiIndex * dbi, char * str, dbiIndexSet * set) { return 0; } -int dbiUpdateIndex(dbiIndex * dbi, char * str, dbiIndexSet * set) { +int dbiUpdateIndex(dbiIndex * dbi, const char * str, dbiIndexSet * set) { /* 0 on success */ DBT key, data; int rc; - key.data = str; + key.data = (void *)str; key.size = strlen(str); if (set->count) { diff --git a/lib/dbindex.h b/lib/dbindex.h index 0e84b8bdf..02adb6315 100644 --- a/lib/dbindex.h +++ b/lib/dbindex.h @@ -35,9 +35,9 @@ extern "C" { dbiIndex * dbiOpenIndex(char * filename, int flags, int perms, DBTYPE type); void dbiCloseIndex(dbiIndex * dbi); void dbiSyncIndex(dbiIndex * dbi); -int dbiSearchIndex(dbiIndex * dbi, char * str, dbiIndexSet * set); +int dbiSearchIndex(dbiIndex * dbi, const char * str, dbiIndexSet * set); /* -1 error, 0 success, 1 not found */ -int dbiUpdateIndex(dbiIndex * dbi, char * str, dbiIndexSet * set); +int dbiUpdateIndex(dbiIndex * dbi, const char * str, dbiIndexSet * set); /* 0 on success */ int dbiAppendIndexRecord(dbiIndexSet * set, dbiIndexRecord rec); /* 0 on success - should never fail */ @@ -45,7 +45,7 @@ int dbiRemoveIndexRecord(dbiIndexSet * set, dbiIndexRecord rec); /* 0 on success - fails if rec is not found */ dbiIndexSet dbiCreateIndexRecord(void); void dbiFreeIndexRecord(dbiIndexSet set); -int dbiGetFirstKey(dbiIndex * dbi, char ** key); +int dbiGetFirstKey(dbiIndex * dbi, const char ** key); extern inline int dbiIndexSetCount(dbiIndexSet set); extern inline int dbiIndexSetCount(dbiIndexSet set) { diff --git a/lib/depends.c b/lib/depends.c index 74fcfdbd3..6dae602b8 100644 --- a/lib/depends.c +++ b/lib/depends.c @@ -695,10 +695,10 @@ static int checkPackageDeps(rpmTransactionSet rpmdep, struct problemsSet * psp, return ourrc; } -int headerMatchesDepFlags(Header h, char * reqInfo, int reqFlags) { - char * name, * version, * release, * chptr; - char * reqVersion = reqInfo; - char * reqRelease = NULL; +int headerMatchesDepFlags(Header h, const char * reqInfo, int reqFlags) { + const char * name, * version, * release, * chptr; + const char * reqVersion = reqInfo; + const char * reqRelease = NULL; int type, count; int_32 * epoch; char buf[20]; @@ -721,9 +721,10 @@ int headerMatchesDepFlags(Header h, char * reqInfo, int reqFlags) { headerGetEntry(h, RPMTAG_VERSION, &type, (void *) &version, &count); chptr = strrchr(reqInfo, '-'); if (chptr) { - reqVersion = alloca(strlen(reqInfo) + 1); - strcpy(reqVersion, reqInfo); - reqVersion[chptr - reqInfo] = '\0'; + char *rv = alloca(strlen(reqInfo) + 1); + strcpy(rv, reqInfo); + rv[chptr - reqInfo] = '\0'; + reqVersion = rv; reqRelease = reqVersion + (chptr - reqInfo) + 1; if (*reqRelease) headerGetEntry(h, RPMTAG_RELEASE, &type, (void *) &release, &count); diff --git a/lib/depends.h b/lib/depends.h index 93d0d1968..ec1c1d147 100644 --- a/lib/depends.h +++ b/lib/depends.h @@ -3,7 +3,7 @@ #include "header.h" -int headerMatchesDepFlags(Header h, char * reqInfo, int reqFlags); +int headerMatchesDepFlags(Header h, const char * reqInfo, int reqFlags); struct availablePackage { Header h; diff --git a/lib/formats.c b/lib/formats.c index 526563016..70789d2b7 100644 --- a/lib/formats.c +++ b/lib/formats.c @@ -186,14 +186,14 @@ static char * depflagsFormat(int_32 type, const void * data, static int fsnamesTag(Header h, int_32 * type, void ** data, int_32 * count, int * freeData) { - char ** list; + const char ** list; if (rpmGetFilesystemList(&list, count)) { return 1; } *type = RPM_STRING_ARRAY_TYPE; - *((char ***) data) = list; + *((const char ***) data) = list; *freeData = 0; @@ -221,7 +221,7 @@ static int instprefixTag(Header h, int_32 * type, void ** data, int_32 * count, static int fssizesTag(Header h, int_32 * type, void ** data, int_32 * count, int * freeData) { - char ** filenames; + const char ** filenames; int_32 * filesizes; uint_32 * usages; int numFiles; diff --git a/lib/fprint.c b/lib/fprint.c index fe16202f4..40377f746 100644 --- a/lib/fprint.c +++ b/lib/fprint.c @@ -12,7 +12,7 @@ struct lookupCache { ino_t ino; }; -static fingerPrint doLookup(char * fullName, int scareMemory, +static fingerPrint doLookup(const char * fullName, int scareMemory, struct lookupCache * cache); static int strCompare(const void * a, const void * b) { @@ -22,14 +22,15 @@ static int strCompare(const void * a, const void * b) { return strcmp(*one, *two); }; -fingerPrint fpLookup(char * fullName, int scareMemory) { +fingerPrint fpLookup(const char * fullName, int scareMemory) { return doLookup(fullName, scareMemory, NULL); } -static fingerPrint doLookup(char * fullName, int scareMemory, +static fingerPrint doLookup(const char * fullName, int scareMemory, struct lookupCache * cache) { char dir[PATH_MAX]; - char * chptr1, * end; + const char * chptr1; + char * end; fingerPrint fp; struct stat sb; char * buf; @@ -74,9 +75,9 @@ static fingerPrint doLookup(char * fullName, int scareMemory, /* if the current directory doesn't exist, we might fail. oh well. likewise if it's too long. */ if (realpath(".", dir) != NULL) { - chptr1 = alloca(strlen(dir) + strlen(fullName) + 2); - sprintf(chptr1, "%s/%s", dir, fullName); - fullName = chptr1; + char *s = alloca(strlen(dir) + strlen(fullName) + 2); + sprintf(s, "%s/%s", dir, fullName); + fullName = chptr1 = s; } } @@ -127,7 +128,7 @@ unsigned int fpHashFunction(const void * key) { const fingerPrint * fp = key; unsigned int hash = 0; char ch; - char * chptr; + const char * chptr; ch = 0; chptr = fp->basename; @@ -144,7 +145,7 @@ int fpEqual(const void * key1, const void * key2) { return FP_EQUAL(*((const fingerPrint *) key1), *((fingerPrint *) key2)); } -void fpLookupList(char ** fullNames, fingerPrint * fpList, int numItems, +void fpLookupList(const char ** fullNames, fingerPrint * fpList, int numItems, int alreadySorted) { int i, j; struct lookupCache cache; diff --git a/lib/fprint.h b/lib/fprint.h index aafb0a81d..d79a9ce8a 100644 --- a/lib/fprint.h +++ b/lib/fprint.h @@ -4,19 +4,19 @@ typedef struct fingerprint_s { dev_t dev; ino_t ino; - char * basename; + const char * basename; } fingerPrint; /* Be carefull with the memory... assert(*fullName == '/' || !scareMemory) */ -fingerPrint fpLookup(char * fullName, int scareMemory); +fingerPrint fpLookup(const char * fullName, int scareMemory); unsigned int fpHashFunction(const void * string); int fpEqual(const void * key1, const void * key2); /* scareMemory is assumed here! */ -void fpLookupList(char ** fullNames, fingerPrint * fpList, int numItems, +void fpLookupList(const char ** fullNames, fingerPrint * fpList, int numItems, int alreadySorted); /* only if !scarceMemory */ -#define fpFree(a) free((a).basename) +#define fpFree(a) free((void *)(a).basename) #define FP_EQUAL(a, b) ((&(a) == &(b)) || \ (((a).dev == (b).dev) && \ @@ -8,7 +8,7 @@ struct fsinfo { }; static struct fsinfo * filesystems; -static char ** fsnames; +static const char ** fsnames; static int numFilesystems; static int getFilesystemList(void); @@ -63,12 +63,13 @@ static int getFilesystemList(void) { fsnames = malloc(sizeof(char *) * (numFilesystems + 1)); for (vm = buf, i = 0; i < num; i++) { + char *fsn; fsnameLength = vm->vmt_data[VMT_STUB].vmt_size; - fsnames[i] = malloc(fsnameLength + 1); - strncpy(fsnames[i],(char *)vm + vm->vmt_data[VMT_STUB].vmt_off, + fsn = malloc(fsnameLength + 1); + strncpy(fsn, (char *)vm + vm->vmt_data[VMT_STUB].vmt_off, fsnameLength); - filesystems[i].mntPoint = fsnames[i]; + filesystems[i].mntPoint = fsnames[i] = fsn; if (stat(filesystems[i].mntPoint, &sb)) { rpmError(RPMERR_STAT, _("failed to stat %s: %s"), fsnames[i], @@ -178,7 +179,7 @@ static int getFilesystemList(void) { } #endif -int rpmGetFilesystemList(char *** listptr, int * num) { +int rpmGetFilesystemList(const char *** listptr, int * num) { if (!fsnames) if (getFilesystemList()) return 1; @@ -189,7 +190,7 @@ int rpmGetFilesystemList(char *** listptr, int * num) { return 0; } -int rpmGetFilesystemUsage(char ** fileList, int_32 * fssizes, int numFiles, +int rpmGetFilesystemUsage(const char ** fileList, int_32 * fssizes, int numFiles, uint_32 ** usagesPtr, int flags) { int_32 * usages; int i, len, j; diff --git a/lib/install.c b/lib/install.c index c2d5b08bb..8c04485a2 100644 --- a/lib/install.c +++ b/lib/install.c @@ -50,9 +50,9 @@ static int installArchive(FD_t fd, struct fileInfo * files, int fileCount, rpmNotifyFunction notify, void * notifydb, Header h, char ** specFile, int archiveSize); -static int installSources(Header h, char * rootdir, FD_t fd, - char ** specFilePtr, rpmNotifyFunction notify, - void * notifyData, char * labelFormat); +static int installSources(Header h, const char * rootdir, FD_t fd, + const char ** specFilePtr, rpmNotifyFunction notify, + void * notifyData, const char * labelFormat); static int markReplacedFiles(rpmdb db, struct replacedFile * replList); static int assembleFileList(Header h, struct fileMemory * mem, int * fileCountPtr, struct fileInfo ** filesPtr, @@ -64,9 +64,9 @@ static void trimChangelog(Header h); /* 0 success */ /* 1 bad magic */ /* 2 error */ -int rpmInstallSourcePackage(char * rootdir, FD_t fd, char ** specFile, +int rpmInstallSourcePackage(const char * rootdir, FD_t fd, const char ** specFile, rpmNotifyFunction notify, void * notifyData, - char * labelFormat, char ** cookie) { + const char * labelFormat, char ** cookie) { int rc, isSource; Header h; int major, minor; @@ -263,7 +263,7 @@ static void trimChangelog(Header h) { /* 0 success */ /* 1 bad magic */ /* 2 error */ -int installBinaryPackage(char * rootdir, rpmdb db, FD_t fd, Header h, +int installBinaryPackage(const char * rootdir, rpmdb db, FD_t fd, Header h, int flags, rpmNotifyFunction notify, void * notifyData, enum fileActions * actions) { int rc; @@ -643,10 +643,10 @@ static int installArchive(FD_t fd, struct fileInfo * files, /* 0 success */ /* 1 bad magic */ /* 2 error */ -static int installSources(Header h, char * rootdir, FD_t fd, - char ** specFilePtr, rpmNotifyFunction notify, +static int installSources(Header h, const char * rootdir, FD_t fd, + const char ** specFilePtr, rpmNotifyFunction notify, void * notifyData, - char * labelFormat) + const char * labelFormat) { char * specFile; int specFileIndex = -1; diff --git a/lib/install.h b/lib/install.h index 0e0a1e861..de1fc38d2 100644 --- a/lib/install.h +++ b/lib/install.h @@ -15,16 +15,16 @@ enum fileTypes { XDIR, BDEV, CDEV, SOCK, PIPE, REG, LINK } ; int removeBinaryPackage(char * root, rpmdb db, unsigned int offset, int flags, enum fileActions * actions); -int runInstScript(char * prefix, Header h, int scriptTag, int progTag, +int runInstScript(const char * prefix, Header h, int scriptTag, int progTag, int arg, int norunScripts, FD_t err); /* this looks for triggers in the database which h would set off */ -int runTriggers(char * root, rpmdb db, int sense, Header h, +int runTriggers(const char * root, rpmdb db, int sense, Header h, int countCorrection); /* while this looks for triggers in h which are set off by things in the db database to calculate arguments to the trigger */ -int runImmedTriggers(char * root, rpmdb db, int sense, Header h, +int runImmedTriggers(const char * root, rpmdb db, int sense, Header h, int countCorrection); -int installBinaryPackage(char * rootdir, rpmdb db, FD_t fd, Header h, +int installBinaryPackage(const char * rootdir, rpmdb db, FD_t fd, Header h, int flags, rpmNotifyFunction notify, void * notifyData, enum fileActions * actions); const char * fileActionString(enum fileActions a); diff --git a/lib/lookup.c b/lib/lookup.c index bfbe427bd..ea496fe22 100644 --- a/lib/lookup.c +++ b/lib/lookup.c @@ -19,7 +19,7 @@ int rpmdbFindByHeader(rpmdb db, Header h, dbiIndexSet * matches) { /* 0 found matches */ /* 1 no matches */ /* 2 error */ -int rpmdbFindByLabel(rpmdb db, char * arg, dbiIndexSet * matches) { +int rpmdbFindByLabel(rpmdb db, const char * arg, dbiIndexSet * matches) { char * localarg, * chptr; char * release; int rc; diff --git a/lib/misc.c b/lib/misc.c index 11e67bfc9..51da6178d 100644 --- a/lib/misc.c +++ b/lib/misc.c @@ -6,8 +6,9 @@ char * RPMVERSION = VERSION; /* just to put a marker in librpm.a */ -char ** splitString(char * str, int length, char sep) { - char * s, * source, * dest; +char ** splitString(const char * str, int length, char sep) { + const char * source; + char * s, * dest; char ** list; int i; int fields; @@ -45,7 +46,7 @@ void freeSplitString(char ** list) { free(list); } -int rpmfileexists(char * filespec) { +int rpmfileexists(const char * filespec) { struct stat buf; if (stat(filespec, &buf)) { @@ -59,20 +60,21 @@ int rpmfileexists(char * filespec) { return 1; } -int rpmvercmp(char * one, char * two) { +int rpmvercmp(const char * a, const char * b) { int num1, num2; char oldch1, oldch2; char * str1, * str2; + char * one, * two; int rc; int isnum; - if (!strcmp(one, two)) return 0; + if (!strcmp(a, b)) return 0; - str1 = alloca(strlen(one) + 1); - str2 = alloca(strlen(two) + 1); + str1 = alloca(strlen(a) + 1); + str2 = alloca(strlen(b) + 1); - strcpy(str1, one); - strcpy(str2, two); + strcpy(str1, a); + strcpy(str2, b); one = str1; two = str2; @@ -312,17 +314,15 @@ char * gidToGname(gid_t gid) { } } -int makeTempFile(char * prefix, char ** fnptr, FD_t * fdptr) { - char * fn; +int makeTempFile(const char * prefix, const char ** fnptr, FD_t * fdptr) { + const char * fn; FD_t fd; int ran; - char * tmpdir = rpmGetVar(RPMVAR_TMPPATH); struct stat sb, sb2; - if (tmpdir == NULL) tmpdir = "/var/tmp"; if (!prefix) prefix = ""; - fn = malloc(strlen(prefix) + 25 + strlen(tmpdir)); + fn = NULL; srand(time(NULL)); ran = rand() % 100000; @@ -330,27 +330,36 @@ int makeTempFile(char * prefix, char ** fnptr, FD_t * fdptr) { /* maybe this should use link/stat? */ do { - sprintf(fn, "%s%s/rpm-tmp.%d", prefix, tmpdir, ran++); + char tfn[32]; + sprintf(tfn, "rpm-tmp.%d", ran++); + if (fn) xfree(fn); + fn = rpmGetPath(prefix, "%{_tmppath}/", tfn, NULL); fd = fdOpen(fn, O_CREAT | O_RDWR | O_EXCL, 0700); } while (fdFileno(fd) < 0 && errno == EEXIST); if (!stat(fn, &sb) && S_ISLNK(sb.st_mode)) { rpmError(RPMERR_SCRIPT, _("error creating temporary file %s"), fn); + xfree(fn); return 1; } if (sb.st_nlink != 1) { rpmError(RPMERR_SCRIPT, _("error creating temporary file %s"), fn); + xfree(fn); return 1; } fstat(fdFileno(fd), &sb2); if (sb2.st_ino != sb.st_ino || sb2.st_dev != sb.st_dev) { rpmError(RPMERR_SCRIPT, _("error creating temporary file %s"), fn); + xfree(fn); return 1; } - if (fnptr) *fnptr = fn; + if (fnptr) + *fnptr = fn; + else + xfree(fn); *fdptr = fd; return 0; diff --git a/lib/misc.h b/lib/misc.h index 78a193015..5af91a40f 100644 --- a/lib/misc.h +++ b/lib/misc.h @@ -4,14 +4,14 @@ #include <unistd.h> #include <sys/types.h> -char ** splitString(char * str, int length, char sep); +char ** splitString(const char * str, int length, char sep); void freeSplitString(char ** list); void stripTrailingSlashes(char * str); -int rpmfileexists(char * filespec); +int rpmfileexists(const char * filespec); -int rpmvercmp(char * one, char * two); -int findMatches(rpmdb db, char * name, char * version, char * release, +int rpmvercmp(const char * one, const char * two); +int findMatches(rpmdb db, const char * name, const char * version, const char * release, dbiIndexSet * matches); /* these are like the normal functions, but they malloc() the space which @@ -28,6 +28,6 @@ int gnameToGid(char * thisGname, gid_t * gid); char * uidToUname(uid_t uid); char * gidToGname(gid_t gid); -int makeTempFile(char * prefix, /*@out@*/char ** fnptr, /*@out@*/FD_t * fdptr); +int makeTempFile(const char * prefix, /*@out@*/const char ** fnptr, /*@out@*/FD_t * fdptr); #endif /* H_MISC */ diff --git a/lib/query.c b/lib/query.c index 75cdc8ff0..f04b7e3d1 100644 --- a/lib/query.c +++ b/lib/query.c @@ -9,9 +9,9 @@ #include "url.h" static char * permsString(int mode); -static void printHeader(Header h, int queryFlags, char * queryFormat); +static void printHeader(Header h, int queryFlags, const char * queryFormat); static void showMatches(rpmdb db, dbiIndexSet matches, int queryFlags, - char * queryFormat); + const char * queryFormat); static void printFileInfo(char * name, unsigned int size, unsigned short mode, unsigned int mtime, unsigned short rdev, char * owner, char * group, int uid, int gid, @@ -113,7 +113,7 @@ static void queryArgCallback(poptContext con, enum poptCallbackReason reason, } } -static int queryHeader(Header h, char * chptr) { +static int queryHeader(Header h, const char * chptr) { char * str; char * error; @@ -128,7 +128,7 @@ static int queryHeader(Header h, char * chptr) { return 0; } -static void printHeader(Header h, int queryFlags, char * queryFormat) { +static void printHeader(Header h, int queryFlags, const char * queryFormat) { char * name, * version, * release; int_32 count, type; char * prefix = NULL; @@ -403,7 +403,7 @@ static void printFileInfo(char * name, unsigned int size, unsigned short mode, } static void showMatches(rpmdb db, dbiIndexSet matches, int queryFlags, - char * queryFormat) { + const char * queryFormat) { int i; Header h; @@ -424,8 +424,8 @@ static void showMatches(rpmdb db, dbiIndexSet matches, int queryFlags, } } -int rpmQuery(char * prefix, enum rpmQuerySources source, int queryFlags, - char * arg, char * queryFormat) { +int rpmQuery(const char * prefix, enum rpmQuerySources source, int queryFlags, + const char * arg, const char * queryFormat) { Header h; int offset; int rc; diff --git a/lib/rebuilddb.c b/lib/rebuilddb.c index 7f587b5c2..70b79750e 100644 --- a/lib/rebuilddb.c +++ b/lib/rebuilddb.c @@ -4,23 +4,26 @@ #include "rpmdb.h" -int rpmdbRebuild(char * rootdir) { +int rpmdbRebuild(const char * rootdir) { rpmdb olddb, newdb; - char * dbpath, * newdbpath; + const char * dbpath = NULL; + const char * newdbpath = NULL; int recnum; Header h; int failed = 0; + int rc = 0; + char tfn[64]; rpmMessage(RPMMESS_DEBUG, _("rebuilding database in rootdir %s\n"), rootdir); - dbpath = rpmGetVar(RPMVAR_DBPATH); - if (!dbpath) { + dbpath = rpmGetPath("%{_dbpath}", NULL); + if (!dbpath || dbpath[0] == '%') { rpmMessage(RPMMESS_DEBUG, _("no dbpath has been set")); return 1; } - newdbpath = alloca(strlen(dbpath) + 50 + strlen(rootdir)); - sprintf(newdbpath, "%s/%s/rebuilddb.%d", rootdir, dbpath, (int) getpid()); + sprintf(tfn, "rebuilddb.%d", (int) getpid()); + newdbpath = rpmGetPath(rootdir, dbpath, tfn, NULL); if (!access(newdbpath, F_OK)) { rpmError(RPMERR_MKDIR, _("temporary database %s already exists"), @@ -33,17 +36,21 @@ int rpmdbRebuild(char * rootdir) { newdbpath, strerror(errno)); } - sprintf(newdbpath, "%s/rebuilddb.%d", dbpath, (int) getpid()); + /* XXX WTFO? */ + xfree(newdbpath); + newdbpath = rpmGetPath(dbpath, tfn, NULL); rpmMessage(RPMMESS_DEBUG, _("opening old database\n")); if (openDatabase(rootdir, dbpath, &olddb, O_RDONLY, 0644, RPMDB_FLAG_MINIMAL)) { - return 1; + rc = 1; + goto exit; } rpmMessage(RPMMESS_DEBUG, _("opening new database\n")); if (openDatabase(rootdir, newdbpath, &newdb, O_RDWR | O_CREAT, 0644, 0)) { - return 1; + rc = 1; + goto exit; } recnum = rpmdbFirstRecNum(olddb); @@ -83,20 +90,26 @@ int rpmdbRebuild(char * rootdir) { "remains in place\n")); rpmdbRemoveDatabase(rootdir, newdbpath); - return 1; + rc = 1; + goto exit; } else { if (rpmdbMoveDatabase(rootdir, newdbpath, dbpath)) { rpmMessage(RPMMESS_ERROR, _("failed to replace old database with new " "database!\n")); rpmMessage(RPMMESS_ERROR, _("replaces files in %s with files from %s " "to recover"), dbpath, newdbpath); - return 1; + rc = 1; + goto exit; } if (rmdir(newdbpath)) rpmMessage(RPMMESS_ERROR, _("failed to remove directory %s: %s\n"), newdbpath, strerror(errno)); } + rc = 0; +exit: + if (dbpath) xfree(dbpath); + if (newdbpath) xfree(newdbpath); - return 0; + return rc; } diff --git a/lib/rpmdb.c b/lib/rpmdb.c index bdc8a547f..8b8c1b924 100644 --- a/lib/rpmdb.c +++ b/lib/rpmdb.c @@ -55,33 +55,39 @@ static int intMatchCmp(const void * one, const void * two) { return 0; }; -int rpmdbOpen (char * prefix, rpmdb *rpmdbp, int mode, int perms) { - char * dbpath; +int rpmdbOpen (const char * prefix, rpmdb *rpmdbp, int mode, int perms) { + const char * dbpath; + int rc; - dbpath = rpmGetVar(RPMVAR_DBPATH); - if (!dbpath) { + dbpath = rpmGetPath("%{_dbpath}", NULL); + if (dbpath == NULL || dbpath[0] == '%') { rpmMessage(RPMMESS_DEBUG, _("no dbpath has been set")); return 1; } - return openDatabase(prefix, dbpath, rpmdbp, mode, perms, 0); + rc = openDatabase(prefix, dbpath, rpmdbp, mode, perms, 0); + xfree(dbpath); + return rc; } -int rpmdbInit (char * prefix, int perms) { +int rpmdbInit (const char * prefix, int perms) { rpmdb db; - char * dbpath; + const char * dbpath; + int rc; - dbpath = rpmGetVar(RPMVAR_DBPATH); - if (!dbpath) { + dbpath = rpmGetPath("%{_dbpath}", NULL); + if (dbpath == NULL || dbpath[0] == '%') { rpmMessage(RPMMESS_DEBUG, _("no dbpath has been set")); return 1; } - return openDatabase(prefix, dbpath, &db, O_CREAT | O_RDWR, perms, + rc = openDatabase(prefix, dbpath, &db, O_CREAT | O_RDWR, perms, RPMDB_FLAG_JUSTCHECK); + xfree(dbpath); + return rc; } -static int openDbFile(char * prefix, char * dbpath, char * shortName, +static int openDbFile(const char * prefix, const char * dbpath, const char * shortName, int justCheck, int perms, dbiIndex ** db, DBTYPE type){ char * filename = alloca(strlen(prefix) + strlen(dbpath) + strlen(shortName) + 20); @@ -102,7 +108,7 @@ static int openDbFile(char * prefix, char * dbpath, char * shortName, return 0; } -int openDatabase(char * prefix, char * dbpath, rpmdb *rpmdbp, int mode, +int openDatabase(const char * prefix, const char * dbpath, rpmdb *rpmdbp, int mode, int perms, int flags) { char * filename; struct rpmdb_s db; @@ -110,7 +116,7 @@ int openDatabase(char * prefix, char * dbpath, rpmdb *rpmdbp, int mode, struct flock lockinfo; int justcheck = flags & RPMDB_FLAG_JUSTCHECK; int minimal = flags & RPMDB_FLAG_MINIMAL; - char * akey; + const char * akey; /* we should accept NULL as a valid prefix */ if (!prefix) prefix=""; @@ -188,7 +194,7 @@ int openDatabase(char * prefix, char * dbpath, rpmdb *rpmdbp, int mode, "use --rebuilddb to generate a new format database")); rc |= 1; } - free(akey); + xfree(akey); } if (!rc) @@ -256,8 +262,8 @@ Header rpmdbGetRecord(rpmdb db, unsigned int offset) { return headerRead(faFileno(db->pkgs), HEADER_MAGIC_NO); } -int rpmdbFindByFile(rpmdb db, char * filespec, dbiIndexSet * matches) { - char * basename; +int rpmdbFindByFile(rpmdb db, const char * filespec, dbiIndexSet * matches) { + const char * basename; fingerPrint fp1, fp2; dbiIndexSet allMatches; int i, rc; @@ -310,27 +316,27 @@ int rpmdbFindByFile(rpmdb db, char * filespec, dbiIndexSet * matches) { return 0; } -int rpmdbFindByProvides(rpmdb db, char * filespec, dbiIndexSet * matches) { +int rpmdbFindByProvides(rpmdb db, const char * filespec, dbiIndexSet * matches) { return dbiSearchIndex(db->providesIndex, filespec, matches); } -int rpmdbFindByRequiredBy(rpmdb db, char * filespec, dbiIndexSet * matches) { +int rpmdbFindByRequiredBy(rpmdb db, const char * filespec, dbiIndexSet * matches) { return dbiSearchIndex(db->requiredbyIndex, filespec, matches); } -int rpmdbFindByConflicts(rpmdb db, char * filespec, dbiIndexSet * matches) { +int rpmdbFindByConflicts(rpmdb db, const char * filespec, dbiIndexSet * matches) { return dbiSearchIndex(db->conflictsIndex, filespec, matches); } -int rpmdbFindByTriggeredBy(rpmdb db, char * filespec, dbiIndexSet * matches) { +int rpmdbFindByTriggeredBy(rpmdb db, const char * filespec, dbiIndexSet * matches) { return dbiSearchIndex(db->triggerIndex, filespec, matches); } -int rpmdbFindByGroup(rpmdb db, char * group, dbiIndexSet * matches) { +int rpmdbFindByGroup(rpmdb db, const char * group, dbiIndexSet * matches) { return dbiSearchIndex(db->groupIndex, group, matches); } -int rpmdbFindPackage(rpmdb db, char * name, dbiIndexSet * matches) { +int rpmdbFindPackage(rpmdb db, const char * name, dbiIndexSet * matches) { return dbiSearchIndex(db->nameIndex, name, matches); } @@ -649,7 +655,7 @@ static void unblockSignals(void) { sigprocmask(SIG_SETMASK, &signalMask, NULL); } -void rpmdbRemoveDatabase(char * rootdir, char * dbpath) { +void rpmdbRemoveDatabase(const char * rootdir, const char * dbpath) { int i; char * filename; @@ -686,7 +692,7 @@ void rpmdbRemoveDatabase(char * rootdir, char * dbpath) { unlink(filename); } -int rpmdbMoveDatabase(char * rootdir, char * olddbpath, char * newdbpath) { +int rpmdbMoveDatabase(const char * rootdir, const char * olddbpath, const char * newdbpath) { int i; char * ofilename, * nfilename; int rc = 0; @@ -755,7 +761,7 @@ int rpmdbFindFpList(rpmdb db, fingerPrint * fpList, dbiIndexSet * matchList, int intMatchesAlloced, numIntMatches; int start, end; int num, rc; - char ** fullfl, **fl; + const char ** fullfl, **fl; int_32 fc; fingerPrint * fps; Header h; diff --git a/lib/rpmdb.h b/lib/rpmdb.h index bddc6b97d..1090f3c0b 100644 --- a/lib/rpmdb.h +++ b/lib/rpmdb.h @@ -14,13 +14,13 @@ extern "C" { #define RPMDB_FLAG_JUSTCHECK (1 << 0) #define RPMDB_FLAG_MINIMAL (1 << 1) -int openDatabase(char * prefix, char * dbpath, rpmdb *rpmdbp, int mode, +int openDatabase(const char * prefix, const char * dbpath, rpmdb *rpmdbp, int mode, int perms, int flags); int rpmdbRemove(rpmdb db, unsigned int offset, int tolerant); int rpmdbAdd(rpmdb db, Header dbentry); int rpmdbUpdateRecord(rpmdb db, int secOffset, Header secHeader); -void rpmdbRemoveDatabase(char * rootdir, char * dbpath); -int rpmdbMoveDatabase(char * rootdir, char * olddbpath, char * newdbpath); +void rpmdbRemoveDatabase(const char * rootdir, const char * dbpath); +int rpmdbMoveDatabase(const char * rootdir, const char * olddbpath, const char * newdbpath); /* matchList must be preallocated!!! */ int rpmdbFindFpList(rpmdb db, fingerPrint * fpList, dbiIndexSet * matchList, int numItems); diff --git a/lib/rpmlib.h b/lib/rpmlib.h index 919ac626e..9c4c4bf3d 100644 --- a/lib/rpmlib.h +++ b/lib/rpmlib.h @@ -288,9 +288,9 @@ typedef void (*rpmNotifyFunction)(const Header h, const rpmNotifyType what, const unsigned long total, void * data); -int rpmdbOpen (char * root, rpmdb * dbp, int mode, int perms); +int rpmdbOpen (const char * root, rpmdb * dbp, int mode, int perms); /* 0 on error */ -int rpmdbInit(char * root, int perms); +int rpmdbInit(const char * root, int perms); /* nonzero on error */ void rpmdbClose (rpmdb db); @@ -299,16 +299,16 @@ int rpmdbNextRecNum(rpmdb db, unsigned int lastOffset); /* 0 at end, -1 on error */ Header rpmdbGetRecord(rpmdb db, unsigned int offset); -int rpmdbFindByFile(rpmdb db, char * filespec, dbiIndexSet * matches); -int rpmdbFindByGroup(rpmdb db, char * group, dbiIndexSet * matches); -int rpmdbFindPackage(rpmdb db, char * name, dbiIndexSet * matches); -int rpmdbFindByProvides(rpmdb db, char * provides, dbiIndexSet * matches); -int rpmdbFindByRequiredBy(rpmdb db, char * requires, dbiIndexSet * matches); -int rpmdbFindByConflicts(rpmdb db, char * conflicts, dbiIndexSet * matches); -int rpmdbFindByTriggeredBy(rpmdb db, char * package, dbiIndexSet * matches); +int rpmdbFindByFile(rpmdb db, const char * filespec, dbiIndexSet * matches); +int rpmdbFindByGroup(rpmdb db, const char * group, dbiIndexSet * matches); +int rpmdbFindPackage(rpmdb db, const char * name, dbiIndexSet * matches); +int rpmdbFindByProvides(rpmdb db, const char * provides, dbiIndexSet * matches); +int rpmdbFindByRequiredBy(rpmdb db, const char * requires, dbiIndexSet * matches); +int rpmdbFindByConflicts(rpmdb db, const char * conflicts, dbiIndexSet * matches); +int rpmdbFindByTriggeredBy(rpmdb db, const char * package, dbiIndexSet * matches); /* these are just convenience functions */ -int rpmdbFindByLabel(rpmdb db, char * label, dbiIndexSet * matches); +int rpmdbFindByLabel(rpmdb db, const char * label, dbiIndexSet * matches); int rpmdbFindByHeader(rpmdb db, Header h, dbiIndexSet * matches); /* we pass these around as an array with a sentinel */ @@ -317,15 +317,15 @@ typedef struct rpmRelocation_s { char * newPath; /* odd behavior is only for backwards compatibility */ } rpmRelocation; -int rpmInstallSourcePackage(char * root, FD_t fd, char ** specFile, +int rpmInstallSourcePackage(const char * root, FD_t fd, const char ** specFile, rpmNotifyFunction notify, void * notifyData, - char * labelFormat, char ** cookie); + const char * labelFormat, char ** cookie); int rpmVersionCompare(Header first, Header second); -int rpmdbRebuild(char * root); +int rpmdbRebuild(const char * root); -int rpmVerifyFile(char * root, Header h, int filenum, int * result, +int rpmVerifyFile(const char * root, Header h, int filenum, int * result, int omitMask); -int rpmVerifyScript(char * root, Header h, FD_t err); +int rpmVerifyScript(const char * root, Header h, FD_t err); /* Transaction sets are inherently unordered! RPM may reorder transaction sets to reduce errors. In general, installs/upgrades are done before @@ -560,11 +560,11 @@ rpmErrorCallBackType rpmErrorSetCallback(rpmErrorCallBackType); void rpmFreeSignature(Header h); -int rpmVerifySignature(char *file, int_32 sigTag, void *sig, int count, +int rpmVerifySignature(const char *file, int_32 sigTag, void *sig, int count, char *result); -int rpmGetFilesystemList(char *** listptr, int * num); -int rpmGetFilesystemUsage(char ** filelist, int_32 * fssizes, int numFiles, +int rpmGetFilesystemList(const char *** listptr, int * num); +int rpmGetFilesystemUsage(const char ** filelist, int_32 * fssizes, int numFiles, uint_32 ** usagesPtr, int flags); enum rpmQuerySources { QUERY_PACKAGE = 0, QUERY_PATH, QUERY_ALL, QUERY_RPM, @@ -588,8 +588,8 @@ struct rpmQueryArguments { int verbose; }; -int rpmQuery(char * prefix, enum rpmQuerySources source, int queryFlags, - char * arg, char * queryFormat); +int rpmQuery(const char * prefix, enum rpmQuerySources source, int queryFlags, + const char * arg, const char * queryFormat); void rpmDisplayQueryTags(FILE * f); #ifdef __cplusplus diff --git a/lib/signature.c b/lib/signature.c index 8c425a070..55d2d8e85 100644 --- a/lib/signature.c +++ b/lib/signature.c @@ -22,15 +22,15 @@ typedef int (*md5func)(const char * fn, unsigned char * digest); -static int makePGPSignature(char *file, void **sig, int_32 *size, - char *passPhrase); +static int makePGPSignature(const char *file, void **sig, int_32 *size, + const char *passPhrase); static int checkSize(FD_t fd, int size, int sigsize); -static int verifySizeSignature(char *datafile, int_32 size, char *result); -static int verifyMD5Signature(char *datafile, unsigned char *sig, +static int verifySizeSignature(const char *datafile, int_32 size, char *result); +static int verifyMD5Signature(const char *datafile, unsigned char *sig, char *result, md5func fn); -static int verifyPGPSignature(char *datafile, void *sig, +static int verifyPGPSignature(const char *datafile, void *sig, int count, char *result); -static int checkPassPhrase(char *passPhrase); +static int checkPassPhrase(const char *passPhrase); int rpmLookupSignatureType(void) { @@ -151,7 +151,7 @@ void rpmFreeSignature(Header h) headerFree(h); } -int rpmAddSignature(Header header, char *file, int_32 sigTag, char *passPhrase) +int rpmAddSignature(Header header, const char *file, int_32 sigTag, const char *passPhrase) { struct stat statbuf; int_32 size; @@ -177,8 +177,8 @@ int rpmAddSignature(Header header, char *file, int_32 sigTag, char *passPhrase) return 0; } -static int makePGPSignature(char *file, void **sig, int_32 *size, - char *passPhrase) +static int makePGPSignature(const char *file, void **sig, int_32 *size, + const char *passPhrase) { char name[1024]; char sigfile[1024]; @@ -270,7 +270,7 @@ static int checkSize(FD_t fd, int size, int sigsize) } } -int rpmVerifySignature(char *file, int_32 sigTag, void *sig, int count, +int rpmVerifySignature(const char *file, int_32 sigTag, void *sig, int count, char *result) { switch (sigTag) { @@ -301,7 +301,7 @@ int rpmVerifySignature(char *file, int_32 sigTag, void *sig, int count, return RPMSIG_OK; } -static int verifySizeSignature(char *datafile, int_32 size, char *result) +static int verifySizeSignature(const char *datafile, int_32 size, char *result) { struct stat statbuf; @@ -317,7 +317,7 @@ static int verifySizeSignature(char *datafile, int_32 size, char *result) return 0; } -static int verifyMD5Signature(char *datafile, unsigned char *sig, +static int verifyMD5Signature(const char *datafile, unsigned char *sig, char *result, md5func fn) { unsigned char md5sum[16]; @@ -350,7 +350,7 @@ static int verifyMD5Signature(char *datafile, unsigned char *sig, return 0; } -static int verifyPGPSignature(char *datafile, void *sig, +static int verifyPGPSignature(const char *datafile, void *sig, int count, char *result) { int pid, status, outpipe[2]; @@ -410,7 +410,7 @@ static int verifyPGPSignature(char *datafile, void *sig, return res; } -char *rpmGetPassPhrase(char *prompt) +char *rpmGetPassPhrase(const char *prompt) { char *pass; @@ -433,7 +433,7 @@ char *rpmGetPassPhrase(char *prompt) return pass; } -static int checkPassPhrase(char *passPhrase) +static int checkPassPhrase(const char *passPhrase) { char name[1024]; int passPhrasePipe[2]; diff --git a/lib/signature.h b/lib/signature.h index 1b35036ce..fe0ce284d 100644 --- a/lib/signature.h +++ b/lib/signature.h @@ -38,8 +38,8 @@ int rpmReadSignature(FD_t fd, Header *header, short sig_type); int rpmWriteSignature(FD_t fd, Header header); /* Generate a signature of data in file, insert in header */ -int rpmAddSignature(Header header, char *file, - int_32 sigTag, char *passPhrase); +int rpmAddSignature(Header header, const char *file, + int_32 sigTag, const char *passPhrase); /******************************************************************/ @@ -47,6 +47,6 @@ int rpmAddSignature(Header header, char *file, int rpmLookupSignatureType(void); /* Utility to read a pass phrase from the user */ -char *rpmGetPassPhrase(char *prompt); +char *rpmGetPassPhrase(const char *prompt); #endif /* H_SIGNATURE */ diff --git a/lib/uninstall.c b/lib/uninstall.c index 7debdc1a8..6cddfb16e 100644 --- a/lib/uninstall.c +++ b/lib/uninstall.c @@ -13,8 +13,8 @@ static char * SCRIPT_PATH = "PATH=/sbin:/bin:/usr/sbin:/usr/bin:" static int removeFile(char * file, unsigned int flags, short mode, enum fileActions action); -static int runScript(Header h, char * root, int progArgc, char ** progArgv, - char * script, int arg1, int arg2, FD_t errfd); +static int runScript(Header h, const char * root, int progArgc, const char ** progArgv, + const char * script, int arg1, int arg2, FD_t errfd); int removeBinaryPackage(char * prefix, rpmdb db, unsigned int offset, int flags, enum fileActions * actions) { @@ -142,19 +142,19 @@ int removeBinaryPackage(char * prefix, rpmdb db, unsigned int offset, return 0; } -static int runScript(Header h, char * root, int progArgc, char ** progArgv, - char * script, int arg1, int arg2, FD_t errfd) { - char ** argv; +static int runScript(Header h, const char * root, int progArgc, const char ** progArgv, + const char * script, int arg1, int arg2, FD_t errfd) { + const char ** argv; int argc; - char ** prefixes = NULL; + const char ** prefixes = NULL; int numPrefixes; - char * oldPrefix; + const char * oldPrefix; int maxPrefixLength; int len; char * prefixBuf; pid_t child; int status; - char * fn; + const char * fn; int i; int freePrefixes = 0; int pipes[2]; @@ -167,7 +167,6 @@ static int runScript(Header h, char * root, int progArgc, char ** progArgv, argv[0] = "/bin/sh"; argc = 1; } else { - argv = progArgv; argv = alloca((progArgc + 4) * sizeof(char *)); memcpy(argv, progArgv, progArgc * sizeof(char *)); argc = progArgc; @@ -209,12 +208,14 @@ static int runScript(Header h, char * root, int progArgc, char ** progArgv, argv[argc++] = fn + strlen(root); if (arg1 >= 0) { - argv[argc] = alloca(20); - sprintf(argv[argc++], "%d", arg1); + char *av = alloca(20); + sprintf(av, "%d", arg1); + argv[argc++] = av; } if (arg2 >= 0) { - argv[argc] = alloca(20); - sprintf(argv[argc++], "%d", arg2); + char *av = alloca(20); + sprintf(av, "%d", arg2); + argv[argc++] = av; } } @@ -271,7 +272,7 @@ static int runScript(Header h, char * root, int progArgc, char ** progArgv, chdir("/"); - execv(argv[0], argv); + execv(argv[0], (char *const *)argv); _exit(-1); } @@ -286,7 +287,7 @@ static int runScript(Header h, char * root, int progArgc, char ** progArgv, if (script) { if (!rpmIsDebug()) unlink(fn); - free(fn); + xfree(fn); } if (!WIFEXITED(status) || WEXITSTATUS(status)) { @@ -297,11 +298,11 @@ static int runScript(Header h, char * root, int progArgc, char ** progArgv, return 0; } -int runInstScript(char * root, Header h, int scriptTag, int progTag, +int runInstScript(const char * root, Header h, int scriptTag, int progTag, int arg, int norunScripts, FD_t err) { void ** programArgv; int programArgc; - char ** argv; + const char ** argv; int programType; char * script; int rc; @@ -316,9 +317,9 @@ int runInstScript(char * root, Header h, int scriptTag, int progTag, if (programArgv && programType == RPM_STRING_TYPE) { argv = alloca(sizeof(char *)); - *argv = (char *) programArgv; + *argv = (const char *) programArgv; } else { - argv = (char **) programArgv; + argv = (const char **) programArgv; } rc = runScript(h, root, programArgc, argv, script, arg, -1, err); @@ -378,11 +379,13 @@ static int removeFile(char * file, unsigned int flags, short mode, return 0; } -static int handleOneTrigger(char * root, rpmdb db, int sense, Header sourceH, +static int handleOneTrigger(const char * root, rpmdb db, int sense, Header sourceH, Header triggeredH, int arg1correction, int arg2, char * triggersAlreadyRun) { - char ** triggerNames, ** triggerVersions; - char ** triggerScripts, ** triggerProgs; + const char ** triggerNames; + const char ** triggerVersions; + const char ** triggerScripts; + const char ** triggerProgs; int_32 * triggerFlags, * triggerIndices; char * triggerPackageName, * sourceName; int numTriggers; @@ -456,7 +459,7 @@ static int handleOneTrigger(char * root, rpmdb db, int sense, Header sourceH, return rc; } -int runTriggers(char * root, rpmdb db, int sense, Header h, +int runTriggers(const char * root, rpmdb db, int sense, Header h, int countCorrection) { char * packageName; dbiIndexSet matches, otherMatches; @@ -494,7 +497,7 @@ int runTriggers(char * root, rpmdb db, int sense, Header h, } -int runImmedTriggers(char * root, rpmdb db, int sense, Header h, +int runImmedTriggers(const char * root, rpmdb db, int sense, Header h, int countCorrection) { int rc = 0; dbiIndexSet matches; diff --git a/lib/verify.c b/lib/verify.c index 0676d5567..52791be8d 100644 --- a/lib/verify.c +++ b/lib/verify.c @@ -13,7 +13,7 @@ static union _endian { int i; char b[4]; } *_endian = (union _endian *)&_ie;; #define S_ISDEV(m) (S_ISBLK((m)) || S_ISCHR((m))) -int rpmVerifyFile(char * prefix, Header h, int filenum, int * result, +int rpmVerifyFile(const char * prefix, Header h, int filenum, int * result, int omitMask) { char ** fileList, ** md5List, ** linktoList; int_32 * verifyFlags, flags; @@ -203,7 +203,7 @@ int rpmVerifyFile(char * prefix, Header h, int filenum, int * result, return 0; } -int rpmVerifyScript(char * root, Header h, FD_t err) { +int rpmVerifyScript(const char * root, Header h, FD_t err) { return runInstScript(root, h, RPMTAG_VERIFYSCRIPT, RPMTAG_VERIFYSCRIPTPROG, 0, 0, err); } diff --git a/po/rpm.pot b/po/rpm.pot index f6c8ea950..6a03dc7b7 100644 --- a/po/rpm.pot +++ b/po/rpm.pot @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" -"POT-Creation-Date: 1999-01-05 18:03-0500\n" +"POT-Creation-Date: 1999-01-06 11:47-0500\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Language-Team: LANGUAGE <LL@li.org>\n" @@ -15,159 +15,159 @@ msgstr "" "Content-Type: text/plain; charset=CHARSET\n" "Content-Transfer-Encoding: ENCODING\n" -#: ../build.c:44 ../build.c:55 +#: ../build.c:44 ../build.c:57 #, c-format msgid "Failed to open tar pipe: %s\n" msgstr "" #. Give up -#: ../build.c:61 +#: ../build.c:65 #, c-format msgid "Failed to read spec file from %s\n" msgstr "" -#: ../build.c:84 +#: ../build.c:90 #, c-format msgid "Failed to rename %s to %s: %s\n" msgstr "" -#: ../build.c:118 +#: ../build.c:128 #, c-format msgid "File is not a regular file: %s\n" msgstr "" -#: ../build.c:123 +#: ../build.c:133 #, c-format msgid "Unable to open spec file: %s\n" msgstr "" -#: ../build.c:131 +#: ../build.c:141 #, c-format msgid "File contains non-printable characters(%c): %s\n" msgstr "" -#: ../build.c:218 +#: ../build.c:228 msgid "buildroot already specified" msgstr "" -#: ../build.c:224 +#: ../build.c:234 msgid "--buildarch has been obsoleted. Use the --target option instead.\n" msgstr "" -#: ../build.c:228 +#: ../build.c:238 msgid "--buildos has been obsoleted. Use the --target option instead.\n" msgstr "" -#: ../build.c:249 +#: ../build.c:259 msgid "override build architecture" msgstr "" -#: ../build.c:251 +#: ../build.c:261 msgid "override build operating system" msgstr "" -#: ../build.c:253 +#: ../build.c:263 msgid "override build root" msgstr "" -#: ../build.c:255 ../rpm.c:429 +#: ../build.c:265 ../rpm.c:429 msgid "remove build tree when done" msgstr "" -#: ../build.c:257 +#: ../build.c:267 msgid "do not execute any stages of the build" msgstr "" -#: ../build.c:259 +#: ../build.c:269 msgid "do not accept I18N msgstr's from specfile" msgstr "" -#: ../build.c:261 +#: ../build.c:271 msgid "remove sources and specfile when done" msgstr "" -#: ../build.c:263 ../rpm.c:427 +#: ../build.c:273 ../rpm.c:427 msgid "skip straight to specified stage (only for c,i)" msgstr "" -#: ../build.c:265 +#: ../build.c:275 msgid "override target platform" msgstr "" -#: ../build.c:267 +#: ../build.c:277 msgid "lookup I18N strings in specfile catalog" msgstr "" -#: ../checksig.c:26 ../checksig.c:158 +#: ../checksig.c:27 ../checksig.c:160 #, c-format msgid "%s: Open failed\n" msgstr "" -#: ../checksig.c:30 ../checksig.c:163 +#: ../checksig.c:31 ../checksig.c:165 #, c-format msgid "%s: readLead failed\n" msgstr "" -#: ../checksig.c:34 +#: ../checksig.c:35 #, c-format msgid "%s: Can't sign v1.0 RPM\n" msgstr "" -#: ../checksig.c:38 +#: ../checksig.c:39 #, c-format msgid "%s: Can't re-sign v2.0 RPM\n" msgstr "" -#: ../checksig.c:42 ../checksig.c:173 +#: ../checksig.c:43 ../checksig.c:175 #, c-format msgid "%s: rpmReadSignature failed\n" msgstr "" -#: ../checksig.c:55 ../checksig.c:187 +#: ../checksig.c:56 ../checksig.c:189 msgid "Couldn't read the header/archive" msgstr "" -#: ../checksig.c:62 +#: ../checksig.c:63 msgid "Couldn't write header/archive to temp file" msgstr "" -#: ../build/pack.c:344 ../checksig.c:87 +#: ../build/pack.c:345 ../checksig.c:88 #, c-format msgid "Generating signature: %d\n" msgstr "" -#: ../checksig.c:110 +#: ../checksig.c:111 msgid "Couldn't read sigtarget" msgstr "" -#: ../checksig.c:119 +#: ../checksig.c:120 msgid "Couldn't write package" msgstr "" -#: ../checksig.c:168 +#: ../checksig.c:170 #, c-format msgid "%s: No signature available (v1.0 RPM)\n" msgstr "" -#: ../checksig.c:178 +#: ../checksig.c:180 #, c-format msgid "%s: No signature available\n" msgstr "" -#: ../checksig.c:194 +#: ../checksig.c:196 #, c-format msgid "Unable to write %s" msgstr "" -#: ../checksig.c:285 +#: ../checksig.c:287 msgid "NOT OK" msgstr "" -#: ../checksig.c:286 ../checksig.c:293 +#: ../checksig.c:288 ../checksig.c:295 msgid " (MISSING KEYS)" msgstr "" -#: ../checksig.c:292 +#: ../checksig.c:294 msgid "OK" msgstr "" @@ -264,84 +264,74 @@ msgstr "" msgid "opening database mode: 0%o\n" msgstr "" -#: ../install.c:156 +#: ../install.c:158 ../install.c:296 #, c-format -msgid "error: cannot open %s%s/packages.rpm\n" +msgid "cannot open %s/packages.rpm\n" msgstr "" -#: ../install.c:166 +#: ../install.c:168 #, c-format msgid "cannot open file %s\n" msgstr "" -#: ../install.c:177 +#: ../install.c:180 ../lib/query.c:478 #, c-format -msgid "error: %s does not appear to be a RPM package\n" +msgid "%s does not appear to be a RPM package\n" msgstr "" -#: ../install.c:180 +#: ../install.c:184 ../install.c:383 #, c-format -msgid "error: %s cannot be installed\n" +msgid "%s cannot be installed\n" msgstr "" -#: ../install.c:193 +#: ../install.c:201 #, c-format msgid "found %d source and %d binary packages\n" msgstr "" -#: ../install.c:203 +#: ../install.c:211 msgid "failed dependencies:\n" msgstr "" -#: ../install.c:219 +#: ../install.c:227 msgid "installing binary packages\n" msgstr "" -#: ../install.c:286 -#, c-format -msgid "cannot open %s%s/packages.rpm\n" -msgstr "" - -#: ../install.c:296 ../lib/query.c:614 ../verify.c:243 +#: ../install.c:307 ../lib/query.c:614 ../verify.c:243 #, c-format msgid "package %s is not installed\n" msgstr "" -#: ../install.c:299 +#: ../install.c:311 #, c-format msgid "searching for package %s\n" msgstr "" -#: ../install.c:307 +#: ../install.c:320 #, c-format msgid "\"%s\" specifies multiple packages\n" msgstr "" -#: ../install.c:332 +#: ../install.c:346 msgid "removing these packages would break dependencies:\n" msgstr "" -#: ../install.c:359 +#: ../install.c:373 #, c-format msgid "cannot open %s\n" msgstr "" -#: ../install.c:364 +#: ../install.c:378 #, c-format msgid "Installing %s\n" msgstr "" -#: ../install.c:369 -#, c-format -msgid "%s cannot be installed\n" -msgstr "" - -#: ../install.c:408 +#: ../install.c:422 #, c-format msgid " is needed by %s-%s-%s\n" msgstr "" -#: ../install.c:411 +#: ../install.c:425 #, c-format msgid " conflicts with %s-%s-%s\n" msgstr "" @@ -1348,7 +1338,7 @@ msgstr "" msgid "error: ftpport must be a number\n" msgstr "" -#: ../lib/rpmdb.c:144 ../url.c:333 +#: ../lib/rpmdb.c:150 ../url.c:333 #, c-format msgid "failed to open %s\n" msgstr "" @@ -1456,7 +1446,7 @@ msgstr "" msgid "no copyright!\n" msgstr "" -#: ../build/build.c:86 ../build/pack.c:262 +#: ../build/build.c:86 ../build/pack.c:263 msgid "Unable to open temp file" msgstr "" @@ -1627,7 +1617,7 @@ msgstr "" msgid "Could not open %%files file: %s" msgstr "" -#: ../build/files.c:1091 ../build/pack.c:447 +#: ../build/files.c:1091 ../build/pack.c:448 #, c-format msgid "line: %s" msgstr "" @@ -1728,71 +1718,71 @@ msgstr "" msgid "readRPM: reading header from %s\n" msgstr "" -#: ../build/pack.c:273 +#: ../build/pack.c:274 msgid "Bad CSA data" msgstr "" -#: ../build/pack.c:296 +#: ../build/pack.c:297 #, c-format msgid "Could not open %s\n" msgstr "" -#: ../build/pack.c:328 ../build/pack.c:371 +#: ../build/pack.c:329 ../build/pack.c:372 #, c-format msgid "Unable to write package: %s" msgstr "" -#: ../build/pack.c:361 +#: ../build/pack.c:362 #, c-format msgid "Unable to read sigtarget: %s" msgstr "" -#: ../build/pack.c:386 +#: ../build/pack.c:387 #, c-format msgid "Wrote: %s\n" msgstr "" -#: ../build/pack.c:401 +#: ../build/pack.c:402 #, c-format msgid "create archive failed on file %s: %s" msgstr "" -#: ../build/pack.c:417 +#: ../build/pack.c:418 #, c-format msgid "cpio_copy write failed: %s" msgstr "" -#: ../build/pack.c:424 +#: ../build/pack.c:425 #, c-format msgid "cpio_copy read failed: %s" msgstr "" -#: ../build/pack.c:503 +#: ../build/pack.c:504 #, c-format msgid "Could not open PreIn file: %s" msgstr "" -#: ../build/pack.c:510 +#: ../build/pack.c:511 #, c-format msgid "Could not open PreUn file: %s" msgstr "" -#: ../build/pack.c:517 +#: ../build/pack.c:518 #, c-format msgid "Could not open PostIn file: %s" msgstr "" -#: ../build/pack.c:524 +#: ../build/pack.c:525 #, c-format msgid "Could not open PostUn file: %s" msgstr "" -#: ../build/pack.c:532 +#: ../build/pack.c:533 #, c-format msgid "Could not open VerifyScript file: %s" msgstr "" -#: ../build/pack.c:548 +#: ../build/pack.c:549 #, c-format msgid "Could not open Trigger script file: %s" msgstr "" @@ -2171,17 +2161,17 @@ msgstr "" msgid "cannot open file %s: " msgstr "" -#: ../lib/dbindex.c:57 +#: ../lib/dbindex.c:59 #, c-format msgid "error getting record %s from %s" msgstr "" -#: ../lib/dbindex.c:85 +#: ../lib/dbindex.c:87 #, c-format msgid "error storing record %s into %s" msgstr "" -#: ../lib/dbindex.c:92 +#: ../lib/dbindex.c:94 #, c-format msgid "error removing record %s into %s" msgstr "" @@ -2206,11 +2196,11 @@ msgstr "" msgid "package %s conflicts: %s\n" msgstr "" -#: ../lib/depends.c:757 +#: ../lib/depends.c:758 msgid "dbrecMatchesDepFlags() failed to read header" msgstr "" -#: ../lib/depends.c:809 +#: ../lib/depends.c:810 #, c-format msgid "loop in prerequisite chain: %s" msgstr "" @@ -2231,17 +2221,17 @@ msgstr "" msgid "mntctl() failed to return fugger size: %s" msgstr "" -#: ../lib/fs.c:74 ../lib/fs.c:236 +#: ../lib/fs.c:75 ../lib/fs.c:237 #, c-format msgid "failed to stat %s: %s" msgstr "" -#: ../lib/fs.c:115 +#: ../lib/fs.c:116 #, c-format msgid "failed to open %s: %s" msgstr "" -#: ../lib/fs.c:257 +#: ../lib/fs.c:258 #, c-format msgid "file %s is on an unknown device" msgstr "" @@ -2378,7 +2368,7 @@ msgstr "" msgid "warning: %s saved as %s" msgstr "" -#: ../lib/install.c:434 ../lib/install.c:785 ../lib/uninstall.c:341 +#: ../lib/install.c:434 ../lib/install.c:785 ../lib/uninstall.c:342 #, c-format msgid "rename of %s to %s failed: %s" msgstr "" @@ -2529,7 +2519,7 @@ msgstr "" msgid "internal error (rpm bug?): " msgstr "" -#: ../lib/misc.c:338 ../lib/misc.c:343 ../lib/misc.c:349 +#: ../lib/misc.c:341 ../lib/misc.c:347 ../lib/misc.c:354 #, c-format msgid "error creating temporary file %s" msgstr "" @@ -2667,11 +2657,6 @@ msgstr "" msgid "old format source packages cannot be queried\n" msgstr "" -#: ../lib/query.c:478 -#, c-format -msgid "%s does not appear to be a RPM package\n" -msgstr "" - #: ../lib/query.c:481 #, c-format msgid "query of %s failed\n" @@ -2717,160 +2702,160 @@ msgstr "" msgid "record %d could not be read\n" msgstr "" -#: ../lib/rebuilddb.c:14 +#: ../lib/rebuilddb.c:17 #, c-format msgid "rebuilding database in rootdir %s\n" msgstr "" -#: ../lib/rebuilddb.c:18 ../lib/rpmdb.c:63 ../lib/rpmdb.c:76 +#: ../lib/rebuilddb.c:21 ../lib/rpmdb.c:64 ../lib/rpmdb.c:80 msgid "no dbpath has been set" msgstr "" -#: ../lib/rebuilddb.c:26 +#: ../lib/rebuilddb.c:29 #, c-format msgid "temporary database %s already exists" msgstr "" -#: ../lib/rebuilddb.c:30 +#: ../lib/rebuilddb.c:33 #, c-format msgid "creating directory: %s\n" msgstr "" -#: ../lib/rebuilddb.c:32 +#: ../lib/rebuilddb.c:35 #, c-format msgid "error creating directory %s: %s" msgstr "" -#: ../lib/rebuilddb.c:38 +#: ../lib/rebuilddb.c:43 msgid "opening old database\n" msgstr "" -#: ../lib/rebuilddb.c:44 +#: ../lib/rebuilddb.c:50 msgid "opening new database\n" msgstr "" -#: ../lib/rebuilddb.c:53 ../lib/rebuilddb.c:71 +#: ../lib/rebuilddb.c:60 ../lib/rebuilddb.c:78 #, c-format msgid "record number %d in database is bad -- skipping it" msgstr "" -#: ../lib/rebuilddb.c:65 +#: ../lib/rebuilddb.c:72 #, c-format msgid "cannot add record originally at %d" msgstr "" -#: ../lib/rebuilddb.c:82 +#: ../lib/rebuilddb.c:89 msgid "failed to rebuild database; original database remains in place\n" msgstr "" -#: ../lib/rebuilddb.c:89 +#: ../lib/rebuilddb.c:97 msgid "failed to replace old database with new database!\n" msgstr "" -#: ../lib/rebuilddb.c:91 +#: ../lib/rebuilddb.c:99 #, c-format msgid "replaces files in %s with files from %s to recover" msgstr "" -#: ../lib/rebuilddb.c:96 +#: ../lib/rebuilddb.c:105 #, c-format msgid "failed to remove directory %s: %s\n" msgstr "" -#: ../lib/rpmdb.c:135 +#: ../lib/rpmdb.c:141 #, c-format msgid "opening database in %s\n" msgstr "" -#: ../lib/rpmdb.c:157 ../lib/rpmdb.c:164 +#: ../lib/rpmdb.c:163 ../lib/rpmdb.c:170 #, c-format msgid "cannot get %s lock on database" msgstr "" -#: ../lib/rpmdb.c:158 +#: ../lib/rpmdb.c:164 msgid "exclusive" msgstr "" -#: ../lib/rpmdb.c:165 +#: ../lib/rpmdb.c:171 msgid "shared" msgstr "" -#: ../lib/rpmdb.c:187 +#: ../lib/rpmdb.c:193 msgid "" "old format database is present; use --rebuilddb to generate a new format " "database" msgstr "" -#: ../lib/rpmdb.c:346 +#: ../lib/rpmdb.c:352 #, c-format msgid "package %s not listed in %s" msgstr "" -#: ../lib/rpmdb.c:357 +#: ../lib/rpmdb.c:363 #, c-format msgid "package %s not found in %s" msgstr "" -#: ../lib/rpmdb.c:381 ../lib/uninstall.c:40 +#: ../lib/rpmdb.c:387 ../lib/uninstall.c:40 #, c-format msgid "cannot read header at %d for uninstall" msgstr "" -#: ../lib/rpmdb.c:389 +#: ../lib/rpmdb.c:395 msgid "package has no name" msgstr "" -#: ../lib/rpmdb.c:391 +#: ../lib/rpmdb.c:397 msgid "removing name index\n" msgstr "" -#: ../lib/rpmdb.c:396 +#: ../lib/rpmdb.c:402 msgid "package has no group\n" msgstr "" -#: ../lib/rpmdb.c:398 +#: ../lib/rpmdb.c:404 msgid "removing group index\n" msgstr "" -#: ../lib/rpmdb.c:405 +#: ../lib/rpmdb.c:411 #, c-format msgid "removing provides index for %s\n" msgstr "" -#: ../lib/rpmdb.c:420 +#: ../lib/rpmdb.c:426 #, c-format msgid "removing requiredby index for %s\n" msgstr "" -#: ../lib/rpmdb.c:432 +#: ../lib/rpmdb.c:438 #, c-format msgid "removing trigger index for %s\n" msgstr "" -#: ../lib/rpmdb.c:443 +#: ../lib/rpmdb.c:449 #, c-format msgid "removing conflict index for %s\n" msgstr "" -#: ../lib/rpmdb.c:460 +#: ../lib/rpmdb.c:466 #, c-format msgid "removing file index for %s\n" msgstr "" -#: ../lib/rpmdb.c:469 +#: ../lib/rpmdb.c:475 msgid "package has no files\n" msgstr "" -#: ../lib/rpmdb.c:542 +#: ../lib/rpmdb.c:548 msgid "cannot allocate space for database" msgstr "" -#: ../lib/rpmdb.c:613 +#: ../lib/rpmdb.c:619 #, c-format msgid "cannot read header at %d for update" msgstr "" -#: ../lib/rpmdb.c:622 +#: ../lib/rpmdb.c:628 msgid "header changed size!" msgstr "" @@ -3072,21 +3057,21 @@ msgstr "" msgid "removing database entry\n" msgstr "" -#: ../lib/uninstall.c:293 +#: ../lib/uninstall.c:294 msgid "execution of script failed" msgstr "" -#: ../lib/uninstall.c:352 +#: ../lib/uninstall.c:353 #, c-format msgid "cannot remove %s - directory not empty" msgstr "" -#: ../lib/uninstall.c:355 +#: ../lib/uninstall.c:356 #, c-format msgid "rmdir of %s failed: %s" msgstr "" -#: ../lib/uninstall.c:363 +#: ../lib/uninstall.c:364 #, c-format msgid "removal of %s failed: %s" msgstr "" diff --git a/popt/po/popt.pot b/popt/po/popt.pot index a8963def5..bf4fa47e1 100644 --- a/popt/po/popt.pot +++ b/popt/po/popt.pot @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" -"POT-Creation-Date: 1998-12-28 21:56-0500\n" +"POT-Creation-Date: 1999-01-06 11:43-0500\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Language-Team: LANGUAGE <LL@li.org>\n" @@ -479,7 +479,7 @@ int main(int argc, char ** argv) { int checksigFlags = 0; unsigned long int timeCheck = 0L; int addSign = NEW_SIGNATURE; - char * specFile; + const char * specFile; char * tce; char * passPhrase = ""; char * cookie = NULL; @@ -1158,7 +1158,7 @@ int main(int argc, char ** argv) { exit(EXIT_FAILURE); } free(cookie); - free(specFile); + xfree(specFile); } break; @@ -1220,7 +1220,7 @@ int main(int argc, char ** argv) { if (noDeps) interfaceFlags |= UNINSTALL_NODEPS; if (allMatches) interfaceFlags |= UNINSTALL_ALLMATCHES; - ec = doUninstall(rootdir, poptGetArgs(optCon), uninstallFlags, + ec = doUninstall(rootdir, (const char **)poptGetArgs(optCon), uninstallFlags, interfaceFlags); break; @@ -1271,7 +1271,7 @@ int main(int argc, char ** argv) { relocations[numRelocations].newPath = NULL; } - ec += doInstall(rootdir, poptGetArgs(optCon), installFlags, + ec += doInstall(rootdir, (const char **)poptGetArgs(optCon), installFlags, interfaceFlags, probFilter, relocations); break; |