Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!seismo!mimsy!chris From: chris@mimsy.UUCP (Chris Torek) Newsgroups: comp.lang.c Subject: Re: creat(name, 0666) (was Re: pipe flushing) Message-ID: <4907@mimsy.UUCP> Date: Fri, 2-Jan-87 08:42:06 EST Article-I.D.: mimsy.4907 Posted: Fri Jan 2 08:42:06 1987 Date-Received: Fri, 2-Jan-87 20:53:39 EST References: <523@bath63.bath.ac.uk> <721@dg_rtp.UUCP> <658@bath63.ux63.bath.ac.uk> <404@hadron.UUCP> Organization: U of Maryland, Dept. of Computer Science, Coll. Pk., MD 20742 Lines: 24 In article <404@hadron.UUCP> jsdy@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@mimsy.umd.edu