summaryrefslogtreecommitdiff
path: root/lang/f2c/patches/patch-ak
diff options
context:
space:
mode:
Diffstat (limited to 'lang/f2c/patches/patch-ak')
-rw-r--r--lang/f2c/patches/patch-ak69
1 files changed, 69 insertions, 0 deletions
diff --git a/lang/f2c/patches/patch-ak b/lang/f2c/patches/patch-ak
new file mode 100644
index 00000000000..48485114a9a
--- /dev/null
+++ b/lang/f2c/patches/patch-ak
@@ -0,0 +1,69 @@
+$NetBSD: patch-ak,v 1.1 2005/01/28 23:37:42 dmcmahill Exp $
+
+--- src/sysdep.c.orig 2000-07-04 22:54:54.000000000 +0000
++++ src/sysdep.c
+@@ -22,6 +22,7 @@ use or performance of this software.
+ ****************************************************************/
+ #include "defs.h"
+ #include "usignal.h"
++#include <stdlib.h>
+
+ char binread[] = "rb", textread[] = "r";
+ char binwrite[] = "wb", textwrite[] = "w";
+@@ -95,8 +96,10 @@ Un_link_all(int cdelete)
+ {
+ if (!debugflag) {
+ unlink(c_functions);
++ unlink(initbname);
+ unlink(initfname);
+ unlink(p1_file);
++ unlink(p1_bakfile);
+ unlink(sortfname);
+ unlink(blkdfname);
+ if (cdelete && coutput)
+@@ -118,6 +121,15 @@ set_tmp_names(Void)
+ p1_file = blkdfname + k;
+ p1_bakfile = p1_file + k;
+ sortfname = p1_bakfile + k;
++#if !defined(MSDOS)
++ sprintf(c_functions, "%s/f2c_func_XXXXXX", tmpdir);
++ sprintf(initfname, "%s/f2c_rc_XXXXXX", tmpdir);
++ sprintf(initbname, "%s/f2c_rc.b_XXXXXX", tmpdir);
++ sprintf(blkdfname, "%s/f2c_blkd_XXXXXX", tmpdir);
++ sprintf(p1_file, "%s/f2c_p1f_XXXXXX", tmpdir);
++ sprintf(p1_bakfile, "%s/f2c_p1fb_XXXXXX", tmpdir);
++ sprintf(sortfname, "%s/f2c_sort_XXXXXX", tmpdir);
++#endif
+ {
+ #ifdef MSDOS
+ char buf[64], *s, *t;
+@@ -156,16 +168,21 @@ set_tmp_names(Void)
+ 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);
++
++ if (mkstemp(c_functions) == -1
++ || mkstemp(initfname) == -1
++ || mkstemp(initbname) == -1
++ || mkstemp(blkdfname) == -1
++ || mkstemp(p1_file) == -1
++ || mkstemp(p1_bakfile) == -1
++ || mkstemp(sortfname) == -1) {
++ fprintf(stderr, "Cannot create temporary files\n");
++ Un_link_all(0);
++ exit(1);
++ }
+ #endif
+- sprintf(initbname, "%s.b", initfname);
+ }
+ if (debugflag)
+ fprintf(diagfile, "%s %s %s %s %s %s\n", c_functions,