Overview
| Artifact ID: | b0a84e6c7501f512afc9d1884569df853d34e022 |
|---|---|
| Ticket: | 453512ffffffffffffffffffffffffffffffffff
tmpnam() is dangerous |
| User & Date: | vincentdarley on 2001-09-03 23:43:05 |
Changes
- assignee changed to: "dkf"
- icomment:
Logged In: YES user_id=32170 How about: Tcl_Obj* TclpTempFileName() { char fileName[L_tmpnam + 9]; Tcl_Obj *result = NULL; int fd; /* * We should also check against making more than * TMP_MAX of these. */ strcpy(fileName, P_tmpdir);/* INTL: Native. */ if (fileName[strlen(fileName) - 1] != '/') { strcat(fileName, "/");/* INTL: Native. */ } strcat(fileName, "tclXXXXXX"); fd = mkstemp(fileName);/* INTL: Native. */ if (fd == -1) { return NULL; } fcntl(fd, F_SETFD, FD_CLOEXEC); unlink(fileName);/* INTL: Native. */ result = TclpNativeToNormalized((ClientData) fileName); close (fd); return result; } - login: "vincentdarley"
- mimetype: "text/plain"
- username: "vincentdarley"