summaryrefslogtreecommitdiffstats
path: root/test-mkstemps.c
diff options
context:
space:
mode:
authorIngo Schwarze <schwarze@openbsd.org>2021-09-19 15:05:39 +0000
committerIngo Schwarze <schwarze@openbsd.org>2021-09-19 15:05:39 +0000
commit56cb4234e5662769045031a7818f3b90d8116331 (patch)
treea0a9c88207b3cd49aacf895846a98ddde0aa6c6c /test-mkstemps.c
parent08a9df104ea806076574e38335bde3b3ed381325 (diff)
downloadmandoc-56cb4234e5662769045031a7818f3b90d8116331.tar.gz
Test availability of mkstemps(3) and provide a fallback implementation
in case it is missing; needed for SUN Solaris 10.
Diffstat (limited to 'test-mkstemps.c')
-rw-r--r--test-mkstemps.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/test-mkstemps.c b/test-mkstemps.c
new file mode 100644
index 00000000..31460dca
--- /dev/null
+++ b/test-mkstemps.c
@@ -0,0 +1,12 @@
+#include <stdlib.h>
+#include <unistd.h>
+
+int
+main(void)
+{
+ char filename[] = "/tmp/temp.XXXXXX.suffix";
+
+ if (mkstemps(filename, 7) == -1)
+ return 1;
+ return unlink(filename) == -1;
+}