From owner-freebsd-questions Mon Aug 27 20:13:34 2001 Delivered-To: freebsd-questions@freebsd.org Received: from mail.XtremeDev.com (xtremedev.com [216.241.38.65]) by hub.freebsd.org (Postfix) with ESMTP id AAA3137B403 for ; Mon, 27 Aug 2001 20:13:30 -0700 (PDT) (envelope-from freebsd@XtremeDev.com) Received: from xtremedev.com (xtremedev.com [216.241.38.65]) by mail.XtremeDev.com (Postfix) with ESMTP id 069C013641 for ; Mon, 27 Aug 2001 21:13:29 -0600 (MDT) Date: Mon, 27 Aug 2001 21:13:28 -0600 (MDT) From: FreeBSD To: Subject: open() in FreeBSD? Message-ID: <20010827210707.G43076-100000@Amber.XtremeDev.com> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG Hello, I have the following test program: #include #include #include int main() { int fd = open("blah", O_WRONLY|O_CREAT); close(fd); return EXIT_SUCCESS; } When I compiled this and run it, ls -l blah gives me: ---------x 1 freebsd freebsd - 0 Aug 27 20:46 blah* Looking through man 2 umask, the default umask is 022. Yet the file created by open() gives me a mask of 001? In the shell I checked the umask, and it indeed is at 022. If the default umask is 022, why does leaving out the third argument to open() not follow chmod/umask as implied by the man 2 open? "open requires a third argument mode_t mode, and the file is created with mode mode as described in chmod(2) and modified by the process' umask value (see umask(2))." - man 2 open In this case it wasn't modified by the process' umask value (as it is set to 022 and verified). fopen() works fine. Can anyone shed some light on this subject? I'm sure I'm missing something simple. Or atleast clear up the man page on what's default and what's not. Thanks in advance. To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message