mktemp is dangerous, better use mkostemp
jackieliu@aarch64:~/liburing$ make -C test
...
/tmp/ccoJ4CQ4.o: In function `main':
/home/jackieliu/liburing/test/500f9fbadef8-test.c:41: warning: the use of `mktemp' is dangerous, better use `mkstemp' or `mkdtemp'
@@ -38,10 +38,9 @@ int main(int argc, char *argv[])
}
sprintf(buf, "./XXXXXX");
- mktemp(buf);
- fd = open(buf, O_WRONLY | O_DIRECT | O_CREAT, 0644);
+ fd = mkostemp(buf, O_WRONLY | O_DIRECT | O_CREAT);
if (fd < 0) {
- perror("mkstemp");
+ perror("mkostemp");
return 1;
}
