#include <stdlib.h>
#include <fcntl.h>
#include <stdio.h>

int main(void) {
	char name[] = "/tmp/mytest-XXXXXX";
	int ret;

	ret = mktemp(name);
	if (ret < 0)
		perror("mktemp");
	ret = open(name, O_RDWR|O_CREAT|O_TRUNC, 0600);
	if (ret < 0)
		perror("open");
	else
		printf("ok\n");
	return 0;
}
