aboutsummaryrefslogtreecommitdiffstatshomepage
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
commit4c96047b6275561be165dc65dd459974a7e3cb5b (patch)
tree2c04122bb04a2210b1c0f2d9e3ab3feab6ed4d27 /test-mkstemps.c
parentda18dde44e7ed710106dba929c6d3e23d85e4666 (diff)
downloadmandoc-4c96047b6275561be165dc65dd459974a7e3cb5b.tar.gz
mandoc-4c96047b6275561be165dc65dd459974a7e3cb5b.tar.zst
mandoc-4c96047b6275561be165dc65dd459974a7e3cb5b.zip
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;
+}