Remove bogus const from rpmGenPath() temporary targets
authorPanu Matilainen <pmatilai@redhat.com>
Sat, 15 Dec 2007 09:03:46 +0000 (11:03 +0200)
committerPanu Matilainen <pmatilai@redhat.com>
Sat, 15 Dec 2007 09:03:46 +0000 (11:03 +0200)
12 files changed:
build.c
build/build.c
build/files.c
build/parsePreamble.c
build/parsePrep.c
lib/psm.c
lib/rpminstall.c
lib/rpmlock.c
rpmdb/db3.c
rpmdb/sqlite.c
rpmio/rpmfileutil.c
rpmio/rpmio.c

diff --git a/build.c b/build.c
index 9c0cbf5..a7dbfa1 100644 (file)
--- a/build.c
+++ b/build.c
@@ -94,7 +94,7 @@ static int buildForTarget(rpmts ts, const char * arg, BTA_t ba)
     const char * passPhrase = ba->passPhrase;
     const char * cookie = ba->cookie;
     int buildAmount = ba->buildAmount;
-    const char * buildRootURL = NULL;
+    char * buildRootURL = NULL;
     const char * specFile;
     const char * specURL;
     int specut;
index 7a6074c..fd3f37b 100644 (file)
@@ -52,7 +52,7 @@ rpmRC doScript(rpmSpec spec, rpmBuildFlags what, const char *name, StringBuf sb,
     const char * rootURL = spec->rootURL;
     const char * rootDir;
     const char *scriptName = NULL;
-    const char * buildDirURL = rpmGenPath(rootURL, "%{_builddir}", "");
+    char * buildDirURL = rpmGenPath(rootURL, "%{_builddir}", "");
     const char * buildScript;
     const char * buildCmd = NULL;
     const char * buildTemplate = NULL;
index 206ada4..e8a16bd 100644 (file)
@@ -1624,7 +1624,8 @@ static rpmRC processMetadataFile(Package pkg, FileList fl, const char * fileURL,
                rpm_tag_t tag)
 {
     const char * buildURL = "%{_builddir}/%{?buildsubdir}/";
-    const char * fn = NULL;
+    const char * urlfn = NULL;
+    char * fn = NULL;
     const char * apkt = NULL;
     uint8_t * pkt = NULL;
     ssize_t pktlen = 0;
@@ -1632,12 +1633,12 @@ static rpmRC processMetadataFile(Package pkg, FileList fl, const char * fileURL,
     int rc = RPMRC_FAIL;
     int xx;
 
-    (void) urlPath(fileURL, &fn);
-    if (*fn == '/') {
-       fn = rpmGenPath(fl->buildRootURL, NULL, fn);
+    (void) urlPath(fileURL, &urlfn);
+    if (*urlfn == '/') {
+       fn = rpmGenPath(fl->buildRootURL, NULL, urlfn);
        absolute = 1;
     } else
-       fn = rpmGenPath(buildURL, NULL, fn);
+       fn = rpmGenPath(buildURL, NULL, urlfn);
 
     switch (tag) {
     default:
@@ -1700,7 +1701,7 @@ static rpmRC processBinaryFile(Package pkg, FileList fl,
 {
     int quote = 1;     /* XXX permit quoted glob characters. */
     int doGlob;
-    const char *diskURL = NULL;
+    char *diskURL = NULL;
     int rc = RPMRC_OK;
     
     doGlob = glob_pattern_p(fileURL, quote);
index 9f4c6b6..37855f8 100644 (file)
@@ -501,7 +501,7 @@ static int handlePreambleTag(rpmSpec spec, Package pkg, rpm_tag_t tag,
     case RPMTAG_BUILDROOT:
        SINGLE_TOKEN_ONLY;
       {        const char * buildRoot = NULL;
-       const char * buildRootURL = spec->buildRootURL;
+       char * buildRootURL;
 
        /*
         * Note: rpmGenPath should guarantee a "canonical" path. That means
@@ -510,7 +510,7 @@ static int handlePreambleTag(rpmSpec spec, Package pkg, rpm_tag_t tag,
         *          //usr//bin/
         *          /.././../usr/../bin//./sh
         */
-       if (buildRootURL == NULL) {
+       if (spec->buildRootURL == NULL) {
            buildRootURL = rpmGenPath(NULL, "%{?buildroot:%{buildroot}}", NULL);
            if (strcmp(buildRootURL, "/")) {
                spec->buildRootURL = buildRootURL;
index 5306ec9..c511426 100644 (file)
@@ -353,7 +353,7 @@ static int doSetupMacro(rpmSpec spec, char *line)
     argv = _free(argv);
 
     /* cd to the build dir */
-    {  const char * buildDirURL = rpmGenPath(spec->rootURL, "%{_builddir}", "");
+    {  char * buildDirURL = rpmGenPath(spec->rootURL, "%{_builddir}", "");
        const char *buildDir;
 
        (void) urlPath(buildDirURL, &buildDir);
index ea797d5..18ecad0 100644 (file)
--- a/lib/psm.c
+++ b/lib/psm.c
@@ -211,8 +211,8 @@ rpmRC rpmInstallSourcePackage(rpmts ts, FD_t fd,
 {
     int scareMem = 1;
     rpmfi fi = NULL;
-    const char * _sourcedir = NULL;
-    const char * _specdir = NULL;
+    char * _sourcedir = NULL;
+    char * _specdir = NULL;
     const char * specFile = NULL;
     HGE_t hge;
     HFD_t hfd;
index 04761f3..76d0c6c 100644 (file)
@@ -362,7 +362,7 @@ if (fileURL[0] == '=') {
        case URL_IS_HTTPS:
        case URL_IS_HTTP:
        case URL_IS_FTP:
-       {   const char *tfn;
+       {   char *tfn;
 
            if (rpmIsVerbose())
                fprintf(stdout, _("Retrieving %s\n"), fileURL);
index 83664d6..808f496 100644 (file)
@@ -34,7 +34,7 @@ static rpmlock rpmlock_new(const char *rootdir)
 
        /* XXX oneshot to determine path for fcntl lock. */
        if (rpmlock_path == NULL) {
-           const char * t = rpmGenPath(rootdir, rpmlock_path_default, NULL);
+           char * t = rpmGenPath(rootdir, rpmlock_path_default, NULL);
            if (t == NULL || *t == '\0' || *t == '%')
                t = strdup(RPMLOCK_PATH);
            rpmlock_path = xstrdup(t);
index b741e62..085bd28 100644 (file)
@@ -319,7 +319,7 @@ static int db_init(dbiIndex dbi, const char * dbhome,
        }
        if (dbi->dbi_tmpdir) {
            const char * root;
-           const char * tmpdir;
+           char * tmpdir;
 
            root = (dbi->dbi_root ? dbi->dbi_root : rpmdb->db_root);
            if ((root[0] == '/' && root[1] == '\0') || rpmdb->db_chrootDone)
@@ -633,7 +633,7 @@ assert(db != NULL);
 static int db3close(dbiIndex dbi, unsigned int flags)
 {
     rpmdb rpmdb = dbi->dbi_rpmdb;
-    const char * urlfn = NULL;
+    char * urlfn = NULL;
     const char * root;
     const char * home;
     const char * dbhome;
@@ -715,7 +715,7 @@ static int db3close(dbiIndex dbi, unsigned int flags)
                (dbi->dbi_verbose & DB_VERB_WAITSFOR));
 
        if (dbi->dbi_tmpdir) {
-           const char * tmpdir = rpmGenPath(root, dbi->dbi_tmpdir, NULL);
+           char * tmpdir = rpmGenPath(root, dbi->dbi_tmpdir, NULL);
            rc = dbenv->set_tmp_dir(dbenv, tmpdir);
            rc = cvtdberr(dbi, "dbenv->set_tmp_dir", rc, _debug);
            tmpdir = _free(tmpdir);
@@ -765,7 +765,7 @@ exit:
 static int db3open(rpmdb rpmdb, rpm_tag_t rpmtag, dbiIndex * dbip)
 {
     extern struct _dbiVec db3vec;
-    const char * urlfn = NULL;
+    char * urlfn = NULL;
     const char * root;
     const char * home;
     const char * dbhome;
index 5e52ae0..f7cf853 100644 (file)
@@ -770,12 +770,12 @@ static int sql_open(rpmdb rpmdb, rpm_tag_t rpmtag, dbiIndex * dbip)
 {
     extern struct _dbiVec sqlitevec;
    
-    const char * urlfn = NULL;
+    char * urlfn = NULL;
     const char * root;
     const char * home;
     const char * dbhome;
     const char * dbfile;  
-    const char * dbfname;
+    char * dbfname;
     const char * sql_errcode;
     dbiIndex dbi;
     SQL_DB * sqldb;
index 3722809..9e33852 100644 (file)
@@ -223,7 +223,7 @@ exit:
 int rpmMkTempFile(const char * prefix, const char ** fnptr, FD_t * fdptr)
 {
     const char * tpmacro = "%{?_tmppath:%{_tmppath}}%{!?_tmppath:" LOCALSTATEDIR "/tmp}";
-    const char * tempfn = NULL;
+    char * tempfn = NULL;
     const char * tfn = NULL;
     static int _initialized = 0;
     int temput;
index 17b8d9e..66aa6a8 100644 (file)
@@ -739,7 +739,7 @@ static FD_t urlOpen(const char * url, int flags, mode_t mode)
 
     urlhelper = rpmExpand("%{?_urlhelper}", NULL);
 
-    dest = (char *) rpmGenPath(NULL, "%{_tmppath}/", "rpm-transfer.XXXXXX");
+    dest = rpmGenPath(NULL, "%{_tmppath}/", "rpm-transfer.XXXXXX");
     close(mkstemp(dest));
     sprintf(cmd, "%s %s %s\n", urlhelper, dest, url);
     urlhelper = _free(urlhelper);