]>
Commit | Line | Data |
---|---|---|
aa0c11c7 | 1 | --- diffutils-2.7.2/sdiff.c.immunix-owl-tmp Fri Mar 30 14:38:57 2001 |
2 | +++ diffutils-2.7.2/sdiff.c Fri Mar 30 14:42:35 2001 | |
3 | @@ -25,6 +25,7 @@ | |
4 | static char const authorship_msgid[] = | |
5 | "Written by Thomas Lord."; | |
6 | \f | |
7 | +#define _GNU_SOURCE | |
8 | #include <stdio.h> | |
9 | #include <signal.h> | |
10 | #include "getopt.h" | |
11 | @@ -1005,13 +1006,27 @@ | |
12 | case 'q': | |
13 | return 0; | |
14 | case 'e': | |
15 | - if (! tmpname && ! (tmpname = private_tempnam ())) | |
16 | - perror_fatal ("tmpnam"); | |
17 | + { | |
18 | + int tfd; | |
19 | + FILE *tmp; | |
20 | ||
21 | - tmpmade = 1; | |
22 | + if (tmpmade) | |
23 | + { | |
24 | + unlink (tmpname); | |
25 | + tmpmade = 0; | |
26 | + free (tmpname); | |
27 | + } | |
28 | ||
29 | - { | |
30 | - FILE *tmp = ck_fopen (tmpname, "w+"); | |
31 | + asprintf (&tmpname, "%s/sdiff.XXXXXX", | |
32 | + getenv("TMPDIR") ?: P_tmpdir); | |
33 | + tfd = mkstemp(tmpname); | |
34 | + if (tfd == -1) | |
35 | + perror_fatal ("temporary file name"); | |
36 | + tmp = fdopen (tfd, "w+"); | |
37 | + if (tmp == NULL) | |
38 | + perror_fatal ("temporary file name"); | |
39 | + | |
40 | + tmpmade = 1; | |
41 | ||
42 | switch (cmd1) | |
43 | { |