From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.org/gmane.linux.lib.musl.general/2720 Path: news.gmane.org!not-for-mail From: "Anthony G. Basile" Newsgroups: gmane.linux.lib.musl.general Subject: Re: [PATCH] Add support for mkostemp, mkstemps and mkostemps Date: Sat, 02 Feb 2013 16:17:36 -0500 Message-ID: <510D8270.5060808@opensource.dyc.edu> References: <1359839705-25965-1-git-send-email-basile@opensource.dyc.edu> Reply-To: musl@lists.openwall.com NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Trace: ger.gmane.org 1359839873 15876 80.91.229.3 (2 Feb 2013 21:17:53 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sat, 2 Feb 2013 21:17:53 +0000 (UTC) To: musl@lists.openwall.com Original-X-From: musl-return-2721-gllmg-musl=m.gmane.org@lists.openwall.com Sat Feb 02 22:18:14 2013 Return-path: Envelope-to: gllmg-musl@plane.gmane.org Original-Received: from mother.openwall.net ([195.42.179.200]) by plane.gmane.org with smtp (Exim 4.69) (envelope-from ) id 1U1kTU-0004MH-3F for gllmg-musl@plane.gmane.org; Sat, 02 Feb 2013 22:18:12 +0100 Original-Received: (qmail 5592 invoked by uid 550); 2 Feb 2013 21:17:53 -0000 Mailing-List: contact musl-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: Original-Received: (qmail 5584 invoked from network); 2 Feb 2013 21:17:53 -0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130121 Thunderbird/17.0.2 In-Reply-To: <1359839705-25965-1-git-send-email-basile@opensource.dyc.edu> Xref: news.gmane.org gmane.linux.lib.musl.general:2720 Archived-At: 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