Kaynağa Gözat

Update to work with recent lib/mlib.c change in md5 handling.

Adam Heath 25 yıl önce
ebeveyn
işleme
a65e70f788
2 değiştirilmiş dosya ile 14 ekleme ve 7 silme
  1. 5 0
      ChangeLog
  2. 9 7
      main/configure.c

+ 5 - 0
ChangeLog

@@ -1,3 +1,8 @@
+Thu Apr 26 13:15:02 CDT 2001 Adam Heath <doogie@debian.org>
+
+  * main/configure.c: Update to work with recent lib/mlib.c change in
+    md5 handling.
+
 Thu Apr 26 11:51:34 CDT 2001 Adam Heath <doogie@debian.org>
 
   * split/{info,join,main,queue,split}.c: s/0/NULL/

+ 9 - 7
main/configure.c

@@ -44,7 +44,7 @@
 
 int conffoptcells[2][2]= { CONFFOPTCELLS };
 
-static void md5hash(struct pkginfo *pkg, char hashbuf[MD5HASHLEN+1], const char *fn);
+static void md5hash(struct pkginfo *pkg, char **hashbuf, const char *fn);
 
 void deferred_configure(struct pkginfo *pkg) {
   /* The algorithm for deciding what to configure first is as follows:
@@ -71,7 +71,7 @@ void deferred_configure(struct pkginfo *pkg) {
   char *cdr2rest;
   int ok, r, useredited, distedited, c, cc, status, c1;
   struct conffile *conff;
-  char currenthash[MD5HASHLEN+1], newdisthash[MD5HASHLEN+1];
+  char *currenthash= 0, *newdisthash= 0;
   struct stat stab;
   enum conffopt what;
   const char *s;
@@ -153,7 +153,7 @@ void deferred_configure(struct pkginfo *pkg) {
         conff->hash= nfstrsave("-");
         continue;
       }
-      md5hash(pkg,currenthash,cdr.buf);
+      md5hash(pkg,&currenthash,cdr.buf);
 
       varbufreset(&cdr2);
       varbufaddstr(&cdr2,cdr.buf);
@@ -166,7 +166,7 @@ void deferred_configure(struct pkginfo *pkg) {
         if (errno == ENOENT) continue;
         ohshite(_("unable to stat new dist conffile `%.250s'"),cdr2.buf);
       }
-      md5hash(pkg,newdisthash,cdr2.buf);
+      md5hash(pkg,&newdisthash,cdr2.buf);
 
       /* Copy the permissions from the installed version to the new
        * distributed version.
@@ -423,6 +423,8 @@ void deferred_configure(struct pkginfo *pkg) {
 
       conff->hash= nfstrsave(newdisthash);
       modstatdb_note(pkg);
+      free(newdisthash);
+      free(currenthash);
       
     } /* for (conff= ... */
     varbuffree(&cdr);
@@ -534,7 +536,7 @@ int conffderef(struct pkginfo *pkg, struct varbuf *result, const char *in) {
   }
 }
     
-static void md5hash(struct pkginfo *pkg, char hashbuf[33], const char *fn) {
+static void md5hash(struct pkginfo *pkg, char **hashbuf, const char *fn) {
   static int fd;
   
   fd= open(fn,O_RDONLY);
@@ -544,10 +546,10 @@ static void md5hash(struct pkginfo *pkg, char hashbuf[33], const char *fn) {
     pop_cleanup(ehflag_normaltidy); /* fd= open(cdr.buf) */
     close(fd);
   } else if (errno == ENOENT) {
-    strcpy(hashbuf,NONEXISTENTFLAG);
+    *hashbuf= strdup(NONEXISTENTFLAG);
   } else {
     fprintf(stderr, _("dpkg: %s: warning - unable to open conffile %s for hash: %s\n"),
             pkg->name, fn, strerror(errno));
-    strcpy(hashbuf,"-");
+    *hashbuf= strdup("-");
   }
 }