Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | Rewrote mkstemp() implementation |
---|---|
Timelines: | family | ancestors | descendants | both | new-driver |
Files: | files | file ages | folders |
SHA1: |
6b27ab3d3566bebbc740450038c536e3 |
User & Date: | rkeene 2013-03-05 03:05:43 |
Context
2013-03-05
| ||
03:08 | Removed much of the original source check-in: 67a663abd1 user: rkeene tags: new-driver | |
03:05 | Rewrote mkstemp() implementation check-in: 6b27ab3d35 user: rkeene tags: new-driver | |
2013-03-04
| ||
23:32 | Create new branch named "new-driver" check-in: 962bbd984e user: rkeene tags: new-driver | |
Changes
Changes to mkstemp.c.
︙ | ︙ | |||
31 32 33 34 35 36 37 | #include <sys/stat.h> #include <stdlib.h> #include <unistd.h> #include <string.h> #include <fcntl.h> int mkstemp(char *template) { | > | < > | > | < | > | > | > > | | | > | | > | 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 | #include <sys/stat.h> #include <stdlib.h> #include <unistd.h> #include <string.h> #include <fcntl.h> int mkstemp(char *template) { unsigned int idx, try; int retfd = -1; char *str; str = strstr(template, "XXXXXX"); if (str == NULL) { return(-1); } srand(getpid()); for (try = 0; try < 10; try++) { for (idx = 0; idx < 6; idx++) { str[idx] = 'A' + ((rand() + idx) % 26); } retfd = open(template, O_EXCL | O_CREAT | O_RDWR, 0600); if (retfd >= 0) { break; } } return(retfd); } |