From owner-freebsd-hackers@FreeBSD.ORG Sun Nov 30 04:01:06 2008 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 7DB7C1065673 for ; Sun, 30 Nov 2008 04:01:06 +0000 (UTC) (envelope-from eitanadlerlist@gmail.com) Received: from mail-gx0-f19.google.com (mail-gx0-f19.google.com [209.85.217.19]) by mx1.freebsd.org (Postfix) with ESMTP id 1D34D8FC16 for ; Sun, 30 Nov 2008 04:01:05 +0000 (UTC) (envelope-from eitanadlerlist@gmail.com) Received: by gxk12 with SMTP id 12so776020gxk.19 for ; Sat, 29 Nov 2008 20:01:05 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:user-agent :mime-version:to:subject:x-enigmail-version:openpgp:content-type :content-transfer-encoding:from; bh=zjG7PgOYE6WSELvPflZRK1zOF1vVqA7lrQbSLIm/IQc=; b=sqYqLzpENLdgV0f2cQflv51Az45/gTc5ik1t43O4cvpOngfhq2Qs/yFRjystXiUGMI LbpsspfakPAfPC5FirFJzKhngD+I8fdLpKZke+9neEE1twZV4xbOuz8HPCLTJco558PP FCPb7m35XUYbk8IIaaC0tZ338koBkKtuv182s= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:user-agent:mime-version:to:subject :x-enigmail-version:openpgp:content-type:content-transfer-encoding :from; b=qOKbWr4lAjow4wmHY0h/InIINY60cVyBtAY5mjIRY65CCvf/rUSluUjH5oyUyxCThR NFnMO3UeVeX+75/TqcAioN/K75oREF54hCYWUwxjcYYVQvz/QbsqsP8+m3+mKhmUYSaj Y4uiGLVQ6NTXj2uHvrM2ENsMp39u1T0b7HBow= Received: by 10.90.35.9 with SMTP id i9mr3795180agi.10.1228017665493; Sat, 29 Nov 2008 20:01:05 -0800 (PST) Received: from aargh.lan (ool-182d26f3.dyn.optonline.net [24.45.38.243]) by mx.google.com with ESMTPS id 7sm3274721agb.34.2008.11.29.20.01.03 (version=TLSv1/SSLv3 cipher=RC4-MD5); Sat, 29 Nov 2008 20:01:04 -0800 (PST) Message-ID: <49320FF7.4040901@gmail.com> Date: Sat, 29 Nov 2008 23:00:55 -0500 User-Agent: Mozilla (X11; U; FreeBSD i386; en-US; ) Gecko Thunderbird Mnenhy/0.7.5.666 MIME-Version: 1.0 To: freebsd-hackers@freebsd.org X-Enigmail-Version: 0.95.7 OpenPGP: id=E9C2CCD1; url=pgp.mit.edu Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit From: Eitan Adler Subject: change to ee.c X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 30 Nov 2008 04:01:06 -0000 -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 I changed this pursuant to a warning I got from gcc. according to the man page "This avoids the race between testing for a file's existence and opening it for use." Could someone on this list please tell me a) If mkstemp is supposed to be used instead b) if not, why not? I tested this change and was able to spell check files (the function which this changes). As an aside I got an unreproducible segfault 11 when I tried to spellcheck an empty file. When I tried again I did not get the same error. I have the ee.core file. - --- ee.c.back 2008-11-29 22:52:28.000000000 -0500 +++ ee.c 2008-11-29 22:52:35.000000000 -0500 @@ -4386,7 +4386,7 @@ return; } (void)sprintf(template, "/tmp/ee.XXXXXXXX"); - - name = mktemp(&template[0]); + name = mkstemp(&template[0]); fd = open(name, O_CREAT | O_EXCL | O_RDWR, 0600); if (fd < 0) { wmove(com_win, 0, 0); - -- Eitan Adler GNU Key fingerptrint: 2E13 BC16 5F54 0FBD 62ED 42B6 B65F 24AB E9C2 CCD1 -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.9 (FreeBSD) iEYEARECAAYFAkkyD/cACgkQtl8kq+nCzNHS/QCghMyQDjyG0dxDgoAj39vBKTBj 6WMAn3H1+6qpCOWR3DloKJlkFeGTdZzp =lE8S -----END PGP SIGNATURE-----