aboutsummaryrefslogtreecommitdiff
path: root/lang
diff options
context:
space:
mode:
Diffstat (limited to 'lang')
-rw-r--r--lang/smlnj/Makefile1
-rw-r--r--lang/smlnj/files/do-patch-base_runtime_c-libs_posix-os_tmpname.c36
2 files changed, 37 insertions, 0 deletions
diff --git a/lang/smlnj/Makefile b/lang/smlnj/Makefile
index 914103d2cbe6..4d7e5ba20306 100644
--- a/lang/smlnj/Makefile
+++ b/lang/smlnj/Makefile
@@ -2,6 +2,7 @@
PORTNAME= smlnj
PORTVERSION= 110.76
+PORTREVISION= 1
CATEGORIES= lang
MASTER_SITES= http://smlnj.cs.uchicago.edu/dist/working/${PORTVERSION}/ \
ftp://mirror.free.de/http/smlnj.cs.uchicago.edu/dist/working/${PORTVERSION}/
diff --git a/lang/smlnj/files/do-patch-base_runtime_c-libs_posix-os_tmpname.c b/lang/smlnj/files/do-patch-base_runtime_c-libs_posix-os_tmpname.c
new file mode 100644
index 000000000000..7424acb78b31
--- /dev/null
+++ b/lang/smlnj/files/do-patch-base_runtime_c-libs_posix-os_tmpname.c
@@ -0,0 +1,36 @@
+--- base/runtime/c-libs/posix-os/tmpname.c.orig 2000-06-01 20:34:03.000000000 +0200
++++ base/runtime/c-libs/posix-os/tmpname.c 2014-08-01 16:35:28.000000000 +0200
+@@ -4,8 +4,11 @@
+ */
+
+ #include <stdio.h>
++#include <string.h>
++#include <unistd.h>
+ #include "ml-base.h"
+ #include "ml-values.h"
++#include "ml-c.h"
+ #include "ml-objects.h"
+ #include "cfun-proto-list.h"
+
+@@ -13,9 +16,18 @@
+ */
+ ml_val_t _ml_OS_tmpname (ml_state_t *msp, ml_val_t arg)
+ {
+- char buf[L_tmpnam];
+-
+- tmpnam (buf);
++ char template[] = "/tmp/TMP-SMLNJ.XXXXXX";
++ char buf[sizeof(template)];
++ int fd;
++
++ strcpy (buf, template);
++
++ fd = mkstemp (buf);
++
++ if (fd == -1)
++ return RAISE_SYSERR(msp, -1);
++ else
++ close (fd);
+
+ return ML_CString (msp, buf);
+