File tmpfile-fix.patch of Package f2c

--- f2c-20020621.orig/src/sysdep.c	2000-07-05 00:54:54.000000000 +0200
+++ f2c-20020621/src/sysdep.c	2005-01-09 17:56:35.000000000 +0100
@@ -111,6 +111,7 @@
 	if (debugflag == 1)
 		return;
 	k = strlen(tmpdir) + 24;
+#ifdef MSDOS
 	c_functions = (char *)ckalloc(7*k);
 	initfname = c_functions + k;
 	initbname = initfname + k;
@@ -118,6 +119,15 @@
 	p1_file = blkdfname + k;
 	p1_bakfile = p1_file + k;
 	sortfname = p1_bakfile + k;
+#else
+	char *c_functions;
+	char *initfname;
+	char *initbname;
+	char *blkdfname;
+	char *p1_file;
+	char *p1_bakfile;
+	char *sortfname;
+#endif
 	{
 #ifdef MSDOS
 	char buf[64], *s, *t;
@@ -156,16 +166,16 @@
 	sprintf(p1_file, "%s%sp1f", t, f2c);
 	sprintf(p1_bakfile, "%s%sp1fb", t, f2c);
 	sprintf(sortfname, "%s%ssort", t, f2c);
+	sprintf(initbname, "%s.b", initfname);
 #else
-	long pid = getpid();
-	sprintf(c_functions, "%s/f2c%ld_func", tmpdir, pid);
-	sprintf(initfname, "%s/f2c%ld_rd", tmpdir, pid);
-	sprintf(blkdfname, "%s/f2c%ld_blkd", tmpdir, pid);
-	sprintf(p1_file, "%s/f2c%ld_p1f", tmpdir, pid);
-	sprintf(p1_bakfile, "%s/f2c%ld_p1fb", tmpdir, pid);
-	sprintf(sortfname, "%s/f2c%ld_sort", tmpdir, pid);
+	c_functions = tempnam(tmpdir,"f2c_func");
+	initfname   = tempnam(tmpdir,"f2c_rc");
+	initbname   = tempnam(tmpdir,"f2c_rc.b");
+	blkdfname   = tempnam(tmpdir,"f2c_blkd");
+	p1_file     = tempnam(tmpdir,"f2c_p1f");
+	p1_bakfile  = tempnam(tmpdir,"f2c_p1fb");
+	sortfname   = tempnam(tmpdir,"f2c_sort");
 #endif
-	sprintf(initbname, "%s.b", initfname);
 	}
 	if (debugflag)
 		fprintf(diagfile, "%s %s %s %s %s %s\n", c_functions,
diff -Nru f2c-20020621.orig/fc f2c-20020621/fc
--- f2c-20020621.orig/fc	2005-01-09 18:11:18.000000000 +0100
+++ f2c-20020621/fc	2005-01-09 18:04:37.000000000 +0100
@@ -81,8 +81,9 @@
 #		-U def		passed to C compiler (for .c files)
 #				or to cpp (for .F files) to remove def
 
-s=/tmp/stderr_$$
-t=/tmp/f77_$$.o
+s=`tempfile --prefix=stderr` || { echo "$0: Cannot create temporary file" ; exit 1; }
+t=`tempfile --suffix=.o --prefix=f77` || { echo "$0: Cannot create temporary file"; exit 1; }
+trap "rm -f $s $t; exit \$rc" 0
 ### On some systems (e.g., IRIX), -common prevents complaints
 ### about multiple definitions of COMMON blocks.
 #CC=${CC_f2c:-'cc -common'}
@@ -95,7 +96,6 @@
 F2CFLAGS=${F2CFLAGS:='-ARw8 -Nn802 -Nq300 -Nx400'}
 CPP=${CPP:-/lib/cpp}
 rc=0
-trap "rm -f $s $t; exit \$rc" 0
 OUTF=a.out
 OUTO=
 cOPT=1
--- f2c-20020621.orig/src/src/xsum0.out
+++ f2c-20020621/src/xsum0.out	2005/01/12 11:07:30
@@ -47,7 +47,7 @@
 proc.c	1d272b9a	38923
 put.c	1a037ae5	10027
 putpcc.c	557e3b5	45941
-sysdep.c	f2fd47b7	14225
+sysdep.c	ff3d441f	14344
 sysdep.h	15f2fca6	2718
 tokens	188b7c5d	733
 usignal.h	1c4ce909	124