Sfoglia il codice sorgente

Use dpkg_db_get_path() instead of using m_asprintf() and admindir

Guillem Jover 15 anni fa
parent
commit
addcf0717e
6 ha cambiato i file con 6 aggiunte e 6 eliminazioni
  1. 1 1
      dselect/method.cc
  2. 1 1
      dselect/methparse.cc
  3. 1 1
      lib/dpkg/dbmodify.c
  4. 1 1
      src/divertcmd.c
  5. 1 1
      src/processarc.c
  6. 1 1
      src/statcmd.c

+ 1 - 1
dselect/method.cc

@@ -106,7 +106,7 @@ static enum urqresult lockmethod(void) {
   struct flock fl;
 
   if (methodlockfile == NULL)
-    m_asprintf(&methodlockfile, "%s/%s", admindir, METHLOCKFILE);
+    methodlockfile = dpkg_db_get_path(METHLOCKFILE);
 
   if (methlockfd == -1) {
     methlockfd= open(methodlockfile, O_RDWR|O_CREAT|O_TRUNC, 0660);

+ 1 - 1
dselect/methparse.cc

@@ -238,7 +238,7 @@ void getcurrentopt() {
   char *p;
 
   if (methoptfile == NULL)
-    m_asprintf(&methoptfile, "%s/%s", admindir, CMETHOPTFILE);
+    methoptfile = dpkg_db_get_path(CMETHOPTFILE);
 
   coption= 0;
   cmo= fopen(methoptfile,"r");

+ 1 - 1
lib/dpkg/dbmodify.c

@@ -156,7 +156,7 @@ modstatdb_init(const char *admindir)
 
   for (fnip = fnis; fnip->suffix; fnip++) {
     free(*fnip->store);
-    m_asprintf(fnip->store, "%s/%s", admindir, fnip->suffix);
+    *fnip->store = dpkg_db_get_path(fnip->suffix);
   }
 
   updatefnbuf = m_malloc(strlen(updatesdir) + IMPORTANTMAXLEN + 5);

+ 1 - 1
src/divertcmd.c

@@ -359,7 +359,7 @@ divertdb_write(void)
 	struct fileiterator *iter;
 	struct filenamenode *namenode;
 
-	m_asprintf(&dbname, "%s/%s", admindir, DIVERSIONSFILE);
+	dbname = dpkg_db_get_path(DIVERSIONSFILE);
 	m_asprintf(&dbname_new, "%s%s", dbname, NEWDBEXT);
 	m_asprintf(&dbname_old, "%s%s", dbname, OLDDBEXT);
 

+ 1 - 1
src/processarc.c

@@ -85,7 +85,7 @@ deb_reassemble(const char **filename, const char **pfilename)
   pid_t pid;
 
   if (!reasmbuf)
-    m_asprintf(&reasmbuf, "%s/%s", admindir, REASSEMBLETMP);
+    reasmbuf = dpkg_db_get_path(REASSEMBLETMP);
   if (unlink(reasmbuf) && errno != ENOENT)
     ohshite(_("error ensuring `%.250s' doesn't exist"), reasmbuf);
 

+ 1 - 1
src/statcmd.c

@@ -197,7 +197,7 @@ statdb_write(void)
 	struct fileiterator *i;
 	struct filenamenode *file;
 
-	m_asprintf(&dbname, "%s/%s", admindir, STATOVERRIDEFILE);
+	dbname = dpkg_db_get_path(STATOVERRIDEFILE);
 	m_asprintf(&dbname_new, "%s%s", dbname, NEWDBEXT);
 	m_asprintf(&dbname_old, "%s%s", dbname, OLDDBEXT);