Date: Fri, 12 Aug 2005 16:32:12 -0400 From: John Baldwin <jhb@FreeBSD.org> To: freebsd-hackers@freebsd.org Cc: hackers@freebsd.org, Igor Pokrovsky <ip@doom.homeunix.org> Subject: Re: perl's tie problem Message-ID: <200508121632.13436.jhb@FreeBSD.org> In-Reply-To: <20050812194927.GA74052@doom.homeunix.org> References: <20050812194927.GA74052@doom.homeunix.org>
next in thread | previous in thread | raw e-mail | index | archive | help
On Friday 12 August 2005 03:49 pm, Igor Pokrovsky wrote: > Hi all, > > Consider the following except from a perl program: > > tie(%foodb, 'MLDBM', $BAR_FILE, O_CREAT | O_RDWR, 0666) > or die("Cannot open $BAR_FILE: $!\n"); > > I expect it to create a new $BAR_FILE, if none existed, with 0666 > permissions. But it doesn't. It creates a file with default umask > specified permissions - 0644. So I have to manually do chmod on that > file afterwards. Is there anything I don't understand? > > %uname -a > FreeBSD doom.homeunix.org 4.11-STABLE FreeBSD 4.11-STABLE #0: > Tue Jul 5 21:05:20 MSD 2005 [...] i386 > > Perl version is 5.8.7 > > Thanks, > > -ip I think this is expected behavior. Your umask setting affects all calls to open(2) with O_CREAT to create a file, and from tie()'s arguments it seems that it uses open(2) to create the destination file. -- John Baldwin <jhb@FreeBSD.org> <>< http://www.FreeBSD.org/~jhb/ "Power Users Use the Power to Serve" = http://www.FreeBSD.org
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200508121632.13436.jhb>