delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2001/09/25/15:33:37

Mailing-List: contact cygwin-help AT sourceware DOT cygnus DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT sources DOT redhat DOT com>
List-Archive: <http://sources.redhat.com/ml/cygwin/>
List-Post: <mailto:cygwin AT sources DOT redhat DOT com>
List-Help: <mailto:cygwin-help AT sources DOT redhat DOT com>, <http://sources.redhat.com/ml/#faqs>
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
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 <martin DOT jerabek AT utanet DOT at>

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/

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019