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 Date: Tue, 25 Sep 2001 21:33:48 +0200 To: cygwin AT cygwin DOT com Subject: Re: open() and mode Message-ID: <20010925213348.B551@mainframe> Mail-Followup-To: cygwin AT cygwin DOT com References: <3BB0D61D DOT 1C93BC64 AT cornell DOT edu> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2.5i In-Reply-To: <3BB0D61D.1C93BC64@cornell.edu>; from id11@cornell.edu on Tue, Sep 25, 2001 at 03:08:14PM -0400 From: Martin Jerabek On Tue, Sep 25, 2001 at 03:08:14PM -0400, Ivan Dobrianov wrote: > Does anyone know why the following code creates a file with read/write > permissions, instead of only read permissions? If I am not completely wrong, you must set the umask *before* creating/opening the file. Setting it afterwards does not influence the permissions of the file just created. > int fd = open ("delme.txt", openflag, mode); > > printf("fd = %d\n", fd); > mode_t mask = umask(0); > umask(mask); > printf("umask = %d\n", mask); Bye Jerry -- 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/