From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Florian Weimer Newsgroups: gmane.emacs.devel Subject: Re: Warning on 'mktemp' [Cygwin] Date: Sun, 23 May 2010 14:25:49 +0200 Message-ID: <874ohyls8i.fsf@mid.deneb.enyo.de> References: <4BF91881.5020902@alice.it> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: dough.gmane.org 1274617571 22900 80.91.229.12 (23 May 2010 12:26:11 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Sun, 23 May 2010 12:26:11 +0000 (UTC) Cc: Emacs To: Angelo Graziosi Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sun May 23 14:26:10 2010 connect(): No such file or directory Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1OGAFm-0005GM-1M for ged-emacs-devel@m.gmane.org; Sun, 23 May 2010 14:26:02 +0200 Original-Received: from localhost ([127.0.0.1]:51063 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OGAFl-0001Yi-8k for ged-emacs-devel@m.gmane.org; Sun, 23 May 2010 08:26:01 -0400 Original-Received: from [140.186.70.92] (port=59718 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OGAFe-0001XZ-Qj for emacs-devel@gnu.org; Sun, 23 May 2010 08:25:55 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OGAFd-0004Hx-BH for emacs-devel@gnu.org; Sun, 23 May 2010 08:25:54 -0400 Original-Received: from ka.mail.enyo.de ([87.106.162.201]:56963) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OGAFd-0004HZ-3M for emacs-devel@gnu.org; Sun, 23 May 2010 08:25:53 -0400 Original-Received: from [172.17.135.4] (helo=deneb.enyo.de) by ka.mail.enyo.de with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) id 1OGAFZ-00007q-N4; Sun, 23 May 2010 14:25:49 +0200 Original-Received: from fw by deneb.enyo.de with local (Exim 4.71) (envelope-from ) id 1OGAFZ-0005kC-GV; Sun, 23 May 2010 14:25:49 +0200 In-Reply-To: <4BF91881.5020902@alice.it> (Angelo Graziosi's message of "Sun, 23 May 2010 13:58:57 +0200") X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:125110 Archived-At: * Angelo Graziosi: > Note that 'configure' says: "checking for mkstemp... yes", so I have > applied this patch: > > ================ > $ cat movemail.c.patch > --- movemail.c.orig 2010-04-02 23:54:26.000000000 +0200 > +++ movemail.c 2010-05-23 12:35:06.296875000 +0200 > @@ -302,7 +302,7 @@ > p--; > *p = 0; > strcpy (p, "EXXXXXX"); > - mktemp (tempname); > + mkstemp (tempname); > unlink (tempname); > > while (1) > ================ > > and the warning disappeared. But is it safe apply it, at least locally > on Cygwin? mkstemp returns a file descriptor which you have to close. And you must not unlink the file, otherwise the behavior is as bad as mktemp() because the race is still there.