www.delorie.com/archives/browse.cgi | search |
Mailing-List: | contact cygwin-help AT cygwin DOT com; run by ezmlm |
List-Subscribe: | <mailto:cygwin-subscribe AT cygwin DOT com> |
List-Archive: | <http://sourceware.org/ml/cygwin/> |
List-Post: | <mailto:cygwin AT cygwin DOT com> |
List-Help: | <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs> |
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" <richardson AT evansville DOT edu> |
Subject: | Re: mkstemp bug |
Date: | Wed, 27 Apr 2005 12:41:20 -0500 |
Lines: | 35 |
Message-ID: | <d4oilk$onv$1@sea.gmane.org> |
References: | <usm1cb0aa DOT fsf AT gnu DOT org> |
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/
webmaster | delorie software privacy |
Copyright © 2019 by DJ Delorie | Updated Jul 2019 |