Message-Id: <200109251917.f8PJHoa31336@delorie.com> Mailing-List: contact cygwin-help AT sourceware DOT cygnus DOT com; run by ezmlm List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT sources DOT redhat DOT com Delivered-To: mailing list cygwin AT sources DOT redhat DOT com From: "Mark Paulus" To: "cygwin AT cygwin DOT com" Date: Tue, 25 Sep 2001 13:17:55 -0600 Reply-To: "Mark Paulus" X-Mailer: PMMail 2000 Professional (2.20.2350) For Windows 2000 (5.0.2195;2) In-Reply-To: <3BB0D61D.1C93BC64@cornell.edu> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Subject: Re: open() and mode Maybe because O_WRONLY means "Open for Write Only", which would imply write permissions, and not just Read??? On Tue, 25 Sep 2001 15:08:14 -0400, Ivan Dobrianov wrote: >This may have a rather obvious answer, but I can't figure it: > >Does anyone know why the following code creates a file with read/write >permissions, instead of only read permissions? >----------------------------- >#include >#include >#include > >int main(int argc, char* argv[]) >{ > int openflag = (O_BINARY | O_CREAT | O_EXCL | O_WRONLY); > mode_t mode = 0x124; > > int fd = open ("delme.txt", openflag, mode); > > printf("fd = %d\n", fd); > mode_t mask = umask(0); > umask(mask); > printf("umask = %d\n", mask); >} >----------------------------- >... then .. ls -l delme.txt gives: > >-rw-r--r-- 1 administ None 0 Sep 25 14:40 delme.txt > >My umask is 0. I can chmod on the file to anything I want. > >-- >Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple >Bug reporting: http://cygwin.com/bugs.html >Documentation: http://cygwin.com/docs.html >FAQ: http://cygwin.com/faq/ -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Bug reporting: http://cygwin.com/bugs.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/