aboutsummaryrefslogtreecommitdiff
path: root/lang/smlnj/files
diff options
context:
space:
mode:
authorKurt Jaeger <pi@FreeBSD.org>2014-08-31 10:42:04 +0000
committerKurt Jaeger <pi@FreeBSD.org>2014-08-31 10:42:04 +0000
commitdc3c0483ad51c917d6499cfe7b22daa5add8aa00 (patch)
tree64f38995504d245aa5e6cddb72cdf1713e1541fe /lang/smlnj/files
parentda0774c5010db07202c22814159e0b2ca60a842b (diff)
downloadports-dc3c0483ad51c917d6499cfe7b22daa5add8aa00.tar.gz
ports-dc3c0483ad51c917d6499cfe7b22daa5add8aa00.zip
Notes
Diffstat (limited to 'lang/smlnj/files')
-rw-r--r--lang/smlnj/files/do-patch-base_runtime_c-libs_posix-os_tmpname.c36
1 files changed, 36 insertions, 0 deletions
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);
+