This is the mail archive of the
cygwin@cygwin.com
mailing list for the Cygwin project.
Re: open() and mode
- To: cygwin at cygwin dot com
- Subject: Re: open() and mode
- From: Martin Jerabek <martin dot jerabek at utanet dot at>
- Date: Tue, 25 Sep 2001 21:33:48 +0200
- References: <3BB0D61D.1C93BC64@cornell.edu>
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/