From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 16255 invoked by alias); 21 Mar 2004 07:12:29 -0000 Mailing-List: contact libc-hacker-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-hacker-owner@sources.redhat.com Received: (qmail 16208 invoked from network); 21 Mar 2004 07:12:28 -0000 Received: from unknown (HELO Cantor.suse.de) (195.135.220.2) by sources.redhat.com with SMTP; 21 Mar 2004 07:12:28 -0000 Received: from hermes.suse.de (Hermes.suse.de [195.135.221.8]) (using TLSv1 with cipher EDH-RSA-DES-CBC3-SHA (168/168 bits)) (No client certificate requested) by Cantor.suse.de (Postfix) with ESMTP id 494FF336485 for ; Sun, 21 Mar 2004 08:12:22 +0100 (CET) Received: from aj by arthur.inka.de with local (Exim 4.22) id 1B4x88-0000c5-N4 for libc-hacker@sources.redhat.com; Sun, 21 Mar 2004 08:12:20 +0100 To: Glibc hackers Subject: Use tmpfile instead of tmpnam From: Andreas Jaeger Date: Mon, 22 Mar 2004 09:04:00 -0000 Message-ID: User-Agent: Gnus/5.1006 (Gnus v5.10.6) XEmacs/21.4 (Rational FORTRAN, linux) MIME-Version: 1.0 Content-Type: multipart/signed; boundary="=-=-="; micalg=pgp-sha1; protocol="application/pgp-signature" X-SW-Source: 2004-03/txt/msg00114.txt.bz2 --=-=-= Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable Content-length: 1334 This is some cosmetic to avoid getting a warning about dangerous use of tmpnam... Ok to commit? Andreas 2004-03-21 Andreas Jaeger * misc/tst-mntent.c (main): Use tmpfile instead of tmpnam. =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D Index: misc/tst-mntent.c --- misc/tst-mntent.c 26 Jul 1999 01:45:55 -0000 1.3 +++ misc/tst-mntent.c 21 Mar 2004 06:43:07 -0000 @@ -11,7 +11,6 @@ main (int argc, char *argv[]) int result =3D 0; struct mntent mef; struct mntent *mnt =3D &mef; - char *name; FILE *fp; =20 mef.mnt_fsname =3D strdupa ("/dev/hda1"); @@ -29,8 +28,7 @@ main (int argc, char *argv[]) result =3D 1; } =20 - name =3D tmpnam (NULL); - fp =3D fopen (name, "w+"); + fp =3D tmpfile (); if (fp =3D=3D NULL) { printf ("Cannot open temporary file: %m\n"); @@ -75,8 +73,6 @@ main (int argc, char *argv[]) puts ("Error while reading written entry back in"); result =3D 1; } - - remove (name); } =20 return result; --=20 Andreas Jaeger, aj@suse.de, http://www.suse.de/~aj SuSE Linux AG, Maxfeldstr. 5, 90409 N=FCrnberg, Germany GPG fingerprint =3D 93A3 365E CE47 B889 DF7F FED1 389A 563C C272 A126 --=-=-= Content-Type: application/pgp-signature Content-length: 188 -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.2 (GNU/Linux) iD8DBQBAXUBUOJpWPMJyoSYRAufkAJ4gmi9bSGMz3Zp97M4nKn6MF6hx5ACfY1ic AL9vEmC/9294Zp4l54fOVcU= =92b8 -----END PGP SIGNATURE----- --=-=-=--