lang/smlnj: fix tmpname warning
PR: 191899 Submitted by: joemann@beefree.free.de (maintainer)
This commit is contained in:
parent
da0774c501
commit
dc3c0483ad
Notes:
svn2git
2021-03-31 03:12:20 +00:00
svn path=/head/; revision=366742
@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
PORTNAME= smlnj
|
PORTNAME= smlnj
|
||||||
PORTVERSION= 110.76
|
PORTVERSION= 110.76
|
||||||
|
PORTREVISION= 1
|
||||||
CATEGORIES= lang
|
CATEGORIES= lang
|
||||||
MASTER_SITES= http://smlnj.cs.uchicago.edu/dist/working/${PORTVERSION}/ \
|
MASTER_SITES= http://smlnj.cs.uchicago.edu/dist/working/${PORTVERSION}/ \
|
||||||
ftp://mirror.free.de/http/smlnj.cs.uchicago.edu/dist/working/${PORTVERSION}/
|
ftp://mirror.free.de/http/smlnj.cs.uchicago.edu/dist/working/${PORTVERSION}/
|
||||||
|
@ -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);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user