summaryrefslogtreecommitdiffstats
path: root/stream.c
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2021-06-02 08:11:25 -0700
committerKaz Kylheku <kaz@kylheku.com>2021-06-02 08:11:25 -0700
commit98a5ae664df526c18bac5d4597c3ae165cd0fd20 (patch)
tree0c1fbf305134247323a4460287e912ac6d2f95a2 /stream.c
parented63896a29e77ea5d3aa0d9f4b5341d3149c2d0a (diff)
downloadtxr-98a5ae664df526c18bac5d4597c3ae165cd0fd20.tar.gz
txr-98a5ae664df526c18bac5d4597c3ae165cd0fd20.tar.bz2
txr-98a5ae664df526c18bac5d4597c3ae165cd0fd20.zip
solaris: unbundle mkstemp and mkdtemp.
* configure: Solaris 10 doesn't have mkdtemp, so we detect it separately from mkstemp, which Solaris 10 does have, producing HAVE_MKSTEMP and MAKE_MKDTEMP config.h symbols. * stream.c (mkdtemp_wrap): Separately surround with #if HAVE_MKDTEMP. (mkstemp_wrap): Reduce scope of #if HAVE_MKSTEMP only around this function. Bugfix here: in the #else case of #if HAVE_MKSTEMPS, we are calling the mkstemps function instead of mkstemp.
Diffstat (limited to 'stream.c')
-rw-r--r--stream.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/stream.c b/stream.c
index 95480a70..50f07495 100644
--- a/stream.c
+++ b/stream.c
@@ -4954,7 +4954,7 @@ val tmpfile_wrap(void)
num(errno), errno_to_str(errno), nao);
}
-#if HAVE_MKSTEMP
+#if HAVE_MKDTEMP
val mkdtemp_wrap(val prefix)
{
@@ -4971,6 +4971,10 @@ val mkdtemp_wrap(val prefix)
num(errno), errno_to_str(errno), nao);
}
+#endif
+
+#if HAVE_MKSTEMP
+
val mkstemp_wrap(val prefix, val suffix)
{
val self = lit("mkstemp");
@@ -4988,7 +4992,7 @@ val mkstemp_wrap(val prefix, val suffix)
free(tmpl);
uw_throwf(system_error_s, lit("~a: suffix not supported"), self, nao);
}
- fd = mkstemps(tmpl);
+ fd = mkstemp(tmpl);
#endif
name = string_utf8(tmpl);
free(tmpl);
@@ -5196,8 +5200,10 @@ void stream_init(void)
reg_varl(intern(lit("indent-code"), user_package), num_fast(indent_code));
reg_varl(intern(lit("indent-foff"), user_package), num_fast(indent_foff));
reg_fun(intern(lit("tmpfile"), user_package), func_n0(tmpfile_wrap));
-#if HAVE_MKSTEMP
+#if HAVE_MKDTEMP
reg_fun(intern(lit("mkdtemp"), user_package), func_n1(mkdtemp_wrap));
+#endif
+#if HAVE_MKSTEMP
reg_fun(intern(lit("mkstemp"), user_package), func_n2o(mkstemp_wrap, 1));
#endif