delorie.com/archives/browse.cgi | search |
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 |
Message-Id: | <4.3.1.2.20010925151805.0243cf08@pop.ma.ultranet.com> |
X-Sender: | lhall AT pop DOT ma DOT ultranet DOT com |
X-Mailer: | QUALCOMM Windows Eudora Version 4.3.1 |
Date: | Tue, 25 Sep 2001 15:19:03 -0400 |
To: | Ivan Dobrianov <id11 AT cornell DOT edu>, cygwin AT cygwin DOT com |
From: | "Larry Hall (RFK Partners, Inc)" <lhall AT rfk DOT com> |
Subject: | Re: open() and mode |
In-Reply-To: | <3BB0D61D.1C93BC64@cornell.edu> |
Mime-Version: | 1.0 |
See the FAQ entry: Why doesn't chmod work? http://www.cygwin.com/faq/faq_4.html#SEC42 Larry Hall lhall AT rfk DOT com RFK Partners, Inc. http://www.rfk.com 118 Washington Street (508) 893-9779 - RFK Office Holliston, MA 01746 (508) 893-9889 - FAX At 03:08 PM 9/25/2001, 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 <stdio.h> >#include <fcntl.h> >#include <sys/stat.h> > >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/
webmaster | delorie software privacy |
Copyright © 2019 by DJ Delorie | Updated Jul 2019 |