--- 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."; +#define _GNU_SOURCE #include #include #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) {