Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 29 Nov 2008 23:00:55 -0500
From:      Eitan Adler <eitanadlerlist@gmail.com>
To:        freebsd-hackers@freebsd.org
Subject:   change to ee.c
Message-ID:  <49320FF7.4040901@gmail.com>

next in thread | raw e-mail | index | archive | help
-----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-----



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?49320FF7.4040901>