summaryrefslogtreecommitdiff
path: root/lang/ruby14-base/patches/patch-ah
diff options
context:
space:
mode:
Diffstat (limited to 'lang/ruby14-base/patches/patch-ah')
-rw-r--r--lang/ruby14-base/patches/patch-ah41
1 files changed, 41 insertions, 0 deletions
diff --git a/lang/ruby14-base/patches/patch-ah b/lang/ruby14-base/patches/patch-ah
new file mode 100644
index 00000000000..9f08268b0c7
--- /dev/null
+++ b/lang/ruby14-base/patches/patch-ah
@@ -0,0 +1,41 @@
+$NetBSD: patch-ah,v 1.1.1.1 2001/06/30 08:25:48 taca Exp $
+
+--- util.c.orig Mon Jan 17 17:24:14 2000
++++ util.c
+@@ -139,7 +139,8 @@
+ }
+
+ char *
+-ruby_mktemp()
++ruby_mktemp(fd)
++ int *fd;
+ {
+ char *dir;
+ char *buf;
+@@ -149,11 +150,22 @@
+ if (!dir) dir = "/tmp";
+
+ buf = ALLOC_N(char,strlen(dir)+10);
+- sprintf(buf, "%s/rbXXXXXX", dir);
+- dir = mktemp(buf);
+- if (dir == NULL) free(buf);
++ *fd = -1;
++ if (buf != NULL) {
++ sprintf(buf, "%s/rbXXXXXX", dir);
++#ifdef HAVE_MKSTEMP
++ *fd = mkstemp(buf);
++#else
++ dir = mktemp(buf);
++ if (dir != NULL)
++ *fd = open(dir, O_CREAT|O_EXCL|O_RDWR, 0600);
++ if (*fd < 0 || dir == NULL) {
++ free(buf);
++ }
++#endif
++ }
+
+- return dir;
++ return buf;
+ }
+
+ #if defined(MSDOS) || defined(__CYGWIN32__) || defined(NT)