Dear Friends, While checking the warnings on tests, I have found this one: tests/tst-truncate.c:10: warning: the use of `tmpnam' is dangerous, better use `mkstemp'
The problem in fixing it with mkstemp() doesn't work exactly the same way and the most similar function I have found is mkostemp() which is a gnu extension I might be wrong since my skills in c/c++ are limited but we have the following possibilities: - disable some gcc flag (?) - reimpliment tmpnam() using other name and possibly other logic - compose file path with P_tmpdir (musl implements it https://github.com/cloudius-systems/musl/blob/master/include/stdio.h) This is the tmpnam implementation from musl http://git.musl-libc.org/cgit/musl/tree/src/stdio/tmpnam.c ... char *tmpnam(char *buf) { static char internal[L_tmpnam]; char s[] = "/tmp/tmpnam_XXXXXX"; int try; int r; for (try=0; try<MAXTRIES; try++) { __randname(s+12); #ifdef SYS_lstat r = __syscall(SYS_lstat, s, &(struct stat){0}); #else r = __syscall(SYS_fstatat, AT_FDCWD, s, &(struct stat){0}, AT_SYMLINK_NOFOLLOW); #endif if (r == -ENOENT) return strcpy(buf ? buf : internal, s); } return 0; } Maybe I could just use "/tmp/XXXXXX", where for every X, I fil with a random number/letter? What do you think? Kind Regards, Geraldo Netto Sapere Aude => Non dvcor, dvco http://exdev.sf.net/ -- You received this message because you are subscribed to the Google Groups "OSv Development" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.
