Просмотр исходного кода

libdpkg: Add a new updatesdir variable in dbmodify

Use it to initialize updatefnbuf, instead of constructing it from
admindir and UPDATESDIR.
Guillem Jover лет назад: 16
Родитель
Сommit
ab9482eb45
1 измененных файлов с 4 добавлено и 3 удалено
  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 FILE *importanttmp;
 static int nextupdate;
+static char *updatesdir;
 static int updateslength;
 static char *updatefnbuf, *updatefnrest;
 static char *infodir;
@@ -132,6 +133,7 @@ static const struct fni {
 } fnis[] = {
   {   STATUSFILE,                 &statusfile         },
   {   AVAILFILE,                  &availablefile      },
+  {   UPDATESDIR,                 &updatesdir         },
   {   UPDATESDIR IMPORTANTTMP,    &importanttmpfile   },
   {   INFODIR,                    &infodir            },
   {   NULL, NULL                                      }
@@ -211,9 +213,8 @@ modstatdb_init(const char *admindir, enum modstatdb_rw 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);
 
   if (cstatus != msdbrw_needsuperuserlockonly) {