From owner-cvs-lib Wed Mar 26 21:02:19 1997 Return-Path: Received: (from root@localhost) by freefall.freebsd.org (8.8.5/8.8.5) id VAA04346 for cvs-lib-outgoing; Wed, 26 Mar 1997 21:02:19 -0800 (PST) Received: from godzilla.zeta.org.au (godzilla.zeta.org.au [203.2.228.19]) by freefall.freebsd.org (8.8.5/8.8.5) with ESMTP id VAA04341; Wed, 26 Mar 1997 21:02:13 -0800 (PST) Received: (from bde@localhost) by godzilla.zeta.org.au (8.8.5/8.6.9) id QAA10260; Thu, 27 Mar 1997 16:00:16 +1100 Date: Thu, 27 Mar 1997 16:00:16 +1100 From: Bruce Evans Message-Id: <199703270500.QAA10260@godzilla.zeta.org.au> To: imp@village.org, peter@spinner.dialix.com Subject: Re: cvs commit: src/lib/libtermcap pathnames.h termcap.c 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 Sender: owner-cvs-lib@FreeBSD.ORG X-Loop: FreeBSD.org Precedence: bulk >> : 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