Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 27 Mar 1997 16:00:16 +1100
From:      Bruce Evans <bde@zeta.org.au>
To:        imp@village.org, peter@spinner.dialix.com
Cc:        ache@nagual.ru, bde@zeta.org.au, cvs-all@freefall.freebsd.org, CVS-committers@freefall.freebsd.org, cvs-lib@freefall.freebsd.org, fenner@parc.xerox.com, phk@critter.dk.tfs.com
Subject:   Re: cvs commit: src/lib/libtermcap pathnames.h termcap.c
Message-ID:  <199703270500.QAA10260@godzilla.zeta.org.au>

next in thread | raw e-mail | index | archive | help
>> : 	warning: this program uses mkstemp(), which is yet another wrong
>> : 	         interface (it should allow setting the open mode).
>> 
>> Can you explain this to me?
>
>Hmm.  Why so Bruce?  It creates the file mode 0600, which is quite safe.  
>If you want to allow 3rd party access, you can always:
>  fd = mkstemp(...);
>  fchmod(fd, ....);

1. It's non-atomic (though safe if the creator can be trusted).
2. Callers have to do more work, and may forget.  E.g., in recent changes,
   the fd was write-only, but became read-write.  This is probably safe
   in recent changes, but isn't always safe.

BTW, mode w+ in fopen.3 is misformatted.

Bruce



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