Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com To: cygwin AT cygwin DOT com From: "Tony Richardson" Subject: Re: mkstemp bug Date: Wed, 27 Apr 2005 12:41:20 -0500 Lines: 35 Message-ID: References: X-Complaints-To: usenet AT sea DOT gmane DOT org X-Gmane-NNTP-Posting-Host: 192.195.225.6 X-Newsreader: Microsoft Outlook Express 6.00.2900.2527 X-RFC2646: Format=Flowed; Original X-IsSubscribed: yes I'm surprised your example doesn't segfault. My Linux man page says explicitly that the template should not be a string constant but must be a character array, i.e. use char t1[] = "/tmp/clisp-x-io-XXXXXX"; char t2[] = "/tmp/clisp-x-io-XXXXXX"; char t3[] = "/tmp/clisp-x-io-XXXXXX"; mkstemp(t1); mkstemp(t2); mkstemp(t3); instead. Tony Richardson p.s. Don't use char *t1 = "/tmp/clisp-x-io-XXXXXX"; either. It's not the same. Constant strings like this and in your original program can be stored in a read-only segment and so are not necessarily writeable. "Sam Steingold" wrote: > Hi, > it appears that mkstemp() returns a temp FD pointing to the same file: > mkstemp ("/tmp/clisp-x-io-XXXXXX"); > ==> "/tmp/clisp-x-io-000592" > mkstemp ("/tmp/clisp-x-io-XXXXXX"); > ==> "/tmp/clisp-x-io-000592" > mkstemp ("/tmp/clisp-x-io-XXXXXX"); > ==> "/tmp/clisp-x-io-000592" -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Problem reports: http://cygwin.com/problems.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/