]> git.pld-linux.org Git - packages/diffutils.git/commitdiff
- fix tmp race (patch from immunix).
authorkloczek <kloczek@pld-linux.org>
Tue, 3 Jul 2001 19:52:17 +0000 (19:52 +0000)
committercvs2git <feedback@pld-linux.org>
Sun, 24 Jun 2012 12:13:13 +0000 (12:13 +0000)
Changed files:
    diffutils-immunix-owl-tmp.patch -> 1.1

diffutils-immunix-owl-tmp.patch [new file with mode: 0644]

diff --git a/diffutils-immunix-owl-tmp.patch b/diffutils-immunix-owl-tmp.patch
new file mode 100644 (file)
index 0000000..89f1584
--- /dev/null
@@ -0,0 +1,43 @@
+--- diffutils-2.7.2/sdiff.c.immunix-owl-tmp    Fri Mar 30 14:38:57 2001
++++ diffutils-2.7.2/sdiff.c    Fri Mar 30 14:42:35 2001
+@@ -25,6 +25,7 @@
+ static char const authorship_msgid[] =
+   "Written by Thomas Lord.";
\f
++#define _GNU_SOURCE
+ #include <stdio.h>
+ #include <signal.h>
+ #include "getopt.h"
+@@ -1005,13 +1006,27 @@
+       case 'q':
+         return 0;
+       case 'e':
+-        if (! tmpname && ! (tmpname = private_tempnam ()))
+-          perror_fatal ("tmpnam");
++        {
++          int tfd;
++          FILE *tmp;
+-        tmpmade = 1;
++          if (tmpmade)
++            {
++              unlink (tmpname);
++              tmpmade = 0;
++              free (tmpname);
++            }
+-        {
+-          FILE *tmp = ck_fopen (tmpname, "w+");
++          asprintf (&tmpname, "%s/sdiff.XXXXXX",
++                    getenv("TMPDIR") ?: P_tmpdir);
++          tfd = mkstemp(tmpname);
++          if (tfd == -1)
++            perror_fatal ("temporary file name");
++          tmp = fdopen (tfd, "w+");
++          if (tmp == NULL)
++            perror_fatal ("temporary file name");
++
++          tmpmade = 1;
+           switch (cmd1)
+             {
This page took 0.099867 seconds and 4 git commands to generate.