creat(name, 0666) (was Re: pipe flushing)
Chris Torek
chris at mimsy.UUCP
Fri Jan 2 23:42:06 AEST 1987
In article <404 at hadron.UUCP> jsdy at hadron.UUCP (Joseph S. D. Yao) writes:
>> if (outfile=creat(*++argv,0666),outfile==EOF)
> I would have made the outfile = ... and if (...) two
> separate statements, to eschew confusion. Also, I never
> make files 0666: that way lies lack of data integrity.
Mode 0666 is almost always correct (on Unix systems). Exceptions
include `secure' programs (e.g., mail systems), programs creating
temporary files purely for their own uses, and programs that make
use of the umask() system call. I would write
if ((outfile = creat(name, 0666)) < 0)
...
or perhaps
if ((outfile = open(name, O_WRONLY|O_CREAT, 0666)) < 0)
...
(I hate having to fix programs to make group writable files group
writable.)
--
In-Real-Life: Chris Torek, Univ of MD Comp Sci Dept (+1 301 454 7690)
UUCP: seismo!mimsy!chris ARPA/CSNet: chris at mimsy.umd.edu
More information about the Comp.lang.c
mailing list