![]() |
|
Message-ID: <510D8270.5060808@opensource.dyc.edu> Date: Sat, 02 Feb 2013 16:17:36 -0500 From: "Anthony G. Basile" <basile@...nsource.dyc.edu> To: musl@...ts.openwall.com Subject: Re: [PATCH] Add support for mkostemp, mkstemps and mkostemps Okay a few points about my last patch. 1. I removed lots of unnecessary headers. 2. I tested using: strcpy(t, "aaaXXXXXX"); mktemp(t); printf("mktemp = %s\n", t); strcpy(t, "aaaXXXXXX"); fd = mkstemp(t); printf("mkstemp = %s\n", t); report_close(fd); //unlink(t); strcpy(t, "aaaXXXXXX"); fd = mkostemp(t, O_WRONLY|O_CLOEXEC); printf("mkostemp = %s\n", t); report_close(fd); //unlink(t); strcpy(t, "aaaXXXXXXzzz"); fd = mkstemps(t, 3); printf("mkstemps = %s\n", t); report_close(fd); //unlink(t); strcpy(t, "aaaXXXXXXzzz"); fd = mkostemps(t, 3, O_WRONLY|O_CLOEXEC); printf("mkostemps = %s\n", t); report_close(fd); //unlink(t); 3. I went with Szabolcs' function to generate entropy: for (i=0; i<6; i++, r>>=5) template[i] = 'A'+(r&15)+(r&16)*2; I think we can commit this (baring any other problems) and think about improving it in the future. As I said before, uclibc/glibc give filenames which include: static const char letters[] = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"; while 'A'+(r&15)+(r&16)*2 gives A-P a-p. So the space of names for the former is 62^6 while for the latter is 32^6. -- Anthony G. Basile, Ph. D. Chair of Information Technology D'Youville College Buffalo, NY 14201 (716) 829-8197
Powered by blists - more mailing lists
Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.