-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Hi, Eitan,
Eitan Adler wrote: > 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); Tanks for interested in this but I'm afraid that your patch is incorrect. mkstemp returns a file descriptor rather than a string pointer, therefore, the subsequent open() would have undefined behavior. It looks like that we actually want fd = mkstemp() here. Note that we may want to bring vendor fixes before making any changes to reduce duplicated work... Cheers, - -- Xin LI <[EMAIL PROTECTED]> http://www.delphij.net/ FreeBSD - The Power to Serve! -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.9 (FreeBSD) iEYEARECAAYFAkkyEioACgkQi+vbBBjt66Dg8QCgw5nCU0G1WnHYtVziiNMpawqh iPwAni7zA4yFnX9waNC0Hmj36rX6yrIG =iJ2c -----END PGP SIGNATURE----- _______________________________________________ freebsd-hackers@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-hackers To unsubscribe, send any mail to "[EMAIL PROTECTED]"