[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#12240: patch



This patch attempts to fix the problem.

diff -ru dpkg-1.4.0.23.2/dpkg-deb/build.c.orig dpkg-1.4.0.23.2/dpkg-deb/build.c
--- dpkg-1.4.0.23.2/dpkg-deb/build.c.orig       Sat Mar  8 21:40:47 1997
+++ dpkg-1.4.0.23.2/dpkg-deb/build.c    Fri Jul  3 22:45:48 1998
@@ -57,13 +57,13 @@
     PREINSTFILE, POSTINSTFILE, PRERMFILE, POSTRMFILE, 0
   };
   
-  char *m;
+  char *m, *tmpd, *tmpf;
   const char *debar, *directory, *const *mscriptp, *versionstring, *arch;
   char *controlfile;
   struct pkginfo *checkedinfo;
   struct arbitraryfield *field;
   FILE *ar, *gz, *cf;
-  int p1[2],p2[2], warns, errs, n, c, subdir;
+  int p1[2],p2[2], warns, errs, n, c, subdir, gzfd;
   pid_t c1,c2,c3,c4,c5;
   struct stat controlstab, datastab, mscriptstab, debarstab;
   char conffilename[MAXCONFFILENAME+1];
@@ -208,7 +208,14 @@
     execlp(TAR,"tar","-cf","-",".",(char*)0); ohshite(_("failed to exec tar -cf"));
   }
   close(p1[1]);
-  if (!(gz= tmpfile())) ohshite(_("failed to make tmpfile (control)"));
+
+  if (!(tmpd = getenv("TMPDIR")))
+    tmpd= "/tmp";
+  tmpf= malloc(strlen(tmpd) + strlen("/dpkg.XXXXXX"));
+  strcpy(tmpf, tmpd);
+  strcat(tmpf, "/dpkg.XXXXXX");
+  if (!(gzfd= mkstemp(tmpf)) || !(gz= fdopen(gzfd, "r+")))
+    ohshite(_("failed to make tmpfile (control)"));
   if (!(c2= m_fork())) {
     m_dup2(p1[0],0); m_dup2(fileno(gz),1); close(p1[0]);
     execlp(GZIP,"gzip","-9c",(char*)0); ohshite(_("failed to exec gzip -9c"));
@@ -245,8 +252,12 @@
   
   if (!oldformatflag) {
     fclose(gz);
-    if (!(gz= tmpfile())) ohshite(_("failed to make tmpfile (data)"));
+    strcpy(tmpf, tmpd);
+    strcat(tmpf, "/dpkg.XXXXXX");
+    if (!(gzfd= mkstemp(tmpf)) || !(gz= fdopen(gzfd, "r+")))
+      ohshite(_("failed to make tmpfile (data)"));
   }
+  free(tmpf);
   m_pipe(p2);
   if (!(c4= m_fork())) {
     m_dup2(p2[1],1); close(p2[0]); close(p2[1]);
diff -ru dpkg-1.4.0.23.2/dpkg-deb/info.c.orig dpkg-1.4.0.23.2/dpkg-deb/info.c
--- dpkg-1.4.0.23.2/dpkg-deb/info.c.orig        Sat Mar  8 22:02:47 1997
+++ dpkg-1.4.0.23.2/dpkg-deb/info.c     Fri Jul  3 22:41:48 1998
@@ -59,12 +59,13 @@
                          const char **debarp,
                          const char **directoryp,
                          int admininfo) {
-  static char dbuf[L_tmpnam];
+  char *dbuf;
   pid_t c1;
   
   *debarp= *(*argvp)++;
   if (!*debarp) badusage(_("--%s needs a .deb filename argument"),cipaction->olong);
-  if (!tmpnam(dbuf)) ohshite(_("failed to make temporary filename"));
+  dbuf = tempnam(NULL, "dpkg");
+  if (!dbuf) ohshite(_("failed to make temporary filename"));
   *directoryp= dbuf;
 
   if (!(c1= m_fork())) {
@@ -73,6 +74,7 @@
   waitsubproc(c1,"rm -rf",0);
   push_cleanup(cu_info_prepare,-1, 0,0, 1, (void*)dbuf);
   extracthalf(*debarp, dbuf, "mx", admininfo);
+  free(dbuf);
 }
 
 static int ilist_select(const struct dirent *de) {




--  
To UNSUBSCRIBE, email to debian-dpkg-request@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org


Reply to: