Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 21 Oct 1998 00:59:40 +1000
From:      Bruce Evans <bde@zeta.org.au>
To:        bde@zeta.org.au, peter@netplex.com.au
Cc:        cvs-all@FreeBSD.ORG, cvs-committers@FreeBSD.ORG
Subject:   Re: cvs commit: src/lib/libc/stdio mktemp.c
Message-ID:  <199810201459.AAA10106@godzilla.zeta.org.au>

next in thread | raw e-mail | index | archive | help

>I'm not sure how to best fix it that is *safe*.

Yes, any change breaks:

	/*
	 * Prevent even ourself from easily accessing the tmp file except
	 * via the fd returned by mkstemp().  Dont ask why :-).
	 */
	umask(0777);
	fd = mkstemp(foo);

>Leaving it failing due to the umask preventing it from opening the file it
>just created isn't ideal because the mk*temp() function has *failed* and
>yet it still created the file.  I don't believe it's safe to

mk*temp() hasn't failed.  It returns a r/w file descriptor for a file
with mod 0000.  vi has problems when it closes this fd and attempts to
reopen it.

For mktemp() and other inferior tmp file functions, there is no way for
the library to affect the mode.

The library shouldn't change the umask except possibly in functions like
setmode() where signals are blocked.

Bruce

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe cvs-all" in the body of the message



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