in reply to Creating file with 777 permission
#!/usr/bin/perl use strict; use warnings; use Fcntl; my $FILE = 'foobarbaz'; umask 0; -e $FILE && unlink $FILE; sysopen my $fh, $FILE, O_CREAT, 0777 or die "$!";
I don't think it's possible to do this with open in an atomic manner (please correct me if I'm wrong). open has a built-in mask of 0666. Just open the file normally and chmod it immediately afterwards.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Creating file with 777 permission
by Anonymous Monk on Nov 22, 2006 at 06:46 UTC |