Prechádzať zdrojové kódy

libdpkg: Add a new updatesdir variable in dbmodify

Use it to initialize updatefnbuf, instead of constructing it from
admindir and UPDATESDIR.
Guillem Jover 16 rokov pred
rodič
commit
ab9482eb45
1 zmenil súbory, kde vykonal 4 pridanie a 3 odobranie
  1. 4 3
      lib/dpkg/dbmodify.c

+ 4 - 3
lib/dpkg/dbmodify.c

@@ -49,6 +49,7 @@ static enum modstatdb_rw cstatus=-1, cflags=0;
 static char *importanttmpfile=NULL;
 static char *importanttmpfile=NULL;
 static FILE *importanttmp;
 static FILE *importanttmp;
 static int nextupdate;
 static int nextupdate;
+static char *updatesdir;
 static int updateslength;
 static int updateslength;
 static char *updatefnbuf, *updatefnrest;
 static char *updatefnbuf, *updatefnrest;
 static char *infodir;
 static char *infodir;
@@ -132,6 +133,7 @@ static const struct fni {
 } fnis[] = {
 } fnis[] = {
   {   STATUSFILE,                 &statusfile         },
   {   STATUSFILE,                 &statusfile         },
   {   AVAILFILE,                  &availablefile      },
   {   AVAILFILE,                  &availablefile      },
+  {   UPDATESDIR,                 &updatesdir         },
   {   UPDATESDIR IMPORTANTTMP,    &importanttmpfile   },
   {   UPDATESDIR IMPORTANTTMP,    &importanttmpfile   },
   {   INFODIR,                    &infodir            },
   {   INFODIR,                    &infodir            },
   {   NULL, NULL                                      }
   {   NULL, NULL                                      }
@@ -211,9 +213,8 @@ modstatdb_init(const char *admindir, enum modstatdb_rw readwritereq)
     internerr("unknown modstatdb_rw '%d'", readwritereq);
     internerr("unknown modstatdb_rw '%d'", readwritereq);
   }
   }
 
 
-  updatefnbuf = m_malloc(strlen(admindir) + sizeof(UPDATESDIR) + IMPORTANTMAXLEN + 5);
-  strcpy(updatefnbuf, admindir);
-  strcat(updatefnbuf,"/" UPDATESDIR);
+  updatefnbuf = m_malloc(strlen(updatesdir) + IMPORTANTMAXLEN + 5);
+  strcpy(updatefnbuf, updatesdir);
   updatefnrest= updatefnbuf+strlen(updatefnbuf);
   updatefnrest= updatefnbuf+strlen(updatefnbuf);
 
 
   if (cstatus != msdbrw_needsuperuserlockonly) {
   if (cstatus != msdbrw_needsuperuserlockonly) {