From: Mark-Jason Dominus Date: Sat, 7 Jul 2001 13:04:04 +0000 (-0400) Subject: Doc patch DB_File.pm: use umask-friendly modes X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=45a340cbcc1516f46316e458cb6325398c662590;p=p5sagit%2Fp5-mst-13.2.git Doc patch DB_File.pm: use umask-friendly modes Message-ID: <20010707170404.32694.qmail@plover.com> p4raw-id: //depot/perl@11194 --- diff --git a/ext/DB_File/DB_File.pm b/ext/DB_File/DB_File.pm index 7fb256e..0a69214 100644 --- a/ext/DB_File/DB_File.pm +++ b/ext/DB_File/DB_File.pm @@ -841,7 +841,7 @@ contents of the database. use vars qw( %h $k $v ) ; unlink "fruit" ; - tie %h, "DB_File", "fruit", O_RDWR|O_CREAT, 0640, $DB_HASH + tie %h, "DB_File", "fruit", O_RDWR|O_CREAT, 0666, $DB_HASH or die "Cannot open file 'fruit': $!\n"; # Add a few key/value pairs to the file @@ -902,7 +902,7 @@ insensitive compare function will be used. $DB_BTREE->{'compare'} = \&Compare ; unlink "tree" ; - tie %h, "DB_File", "tree", O_RDWR|O_CREAT, 0640, $DB_BTREE + tie %h, "DB_File", "tree", O_RDWR|O_CREAT, 0666, $DB_BTREE or die "Cannot open file 'tree': $!\n" ; # Add a key/value pair to the file @@ -967,7 +967,7 @@ code: # Enable duplicate records $DB_BTREE->{'flags'} = R_DUP ; - tie %h, "DB_File", $filename, O_RDWR|O_CREAT, 0640, $DB_BTREE + tie %h, "DB_File", $filename, O_RDWR|O_CREAT, 0666, $DB_BTREE or die "Cannot open $filename: $!\n"; # Add some key/value pairs to the file @@ -1022,7 +1022,7 @@ Here is the script above rewritten using the C API method. # Enable duplicate records $DB_BTREE->{'flags'} = R_DUP ; - $x = tie %h, "DB_File", $filename, O_RDWR|O_CREAT, 0640, $DB_BTREE + $x = tie %h, "DB_File", $filename, O_RDWR|O_CREAT, 0666, $DB_BTREE or die "Cannot open $filename: $!\n"; # Add some key/value pairs to the file @@ -1093,7 +1093,7 @@ this: # Enable duplicate records $DB_BTREE->{'flags'} = R_DUP ; - $x = tie %h, "DB_File", $filename, O_RDWR|O_CREAT, 0640, $DB_BTREE + $x = tie %h, "DB_File", $filename, O_RDWR|O_CREAT, 0666, $DB_BTREE or die "Cannot open $filename: $!\n"; my $cnt = $x->get_dup("Wall") ; @@ -1143,7 +1143,7 @@ Assuming the database from the previous example: # Enable duplicate records $DB_BTREE->{'flags'} = R_DUP ; - $x = tie %h, "DB_File", $filename, O_RDWR|O_CREAT, 0640, $DB_BTREE + $x = tie %h, "DB_File", $filename, O_RDWR|O_CREAT, 0666, $DB_BTREE or die "Cannot open $filename: $!\n"; $found = ( $x->find_dup("Wall", "Larry") == 0 ? "" : "not") ; @@ -1182,7 +1182,7 @@ Again assuming the existence of the C database # Enable duplicate records $DB_BTREE->{'flags'} = R_DUP ; - $x = tie %h, "DB_File", $filename, O_RDWR|O_CREAT, 0640, $DB_BTREE + $x = tie %h, "DB_File", $filename, O_RDWR|O_CREAT, 0666, $DB_BTREE or die "Cannot open $filename: $!\n"; $x->del_dup("Wall", "Larry") ; @@ -1235,7 +1235,7 @@ and print the first matching key/value pair given a partial key. $filename = "tree" ; unlink $filename ; - $x = tie %h, "DB_File", $filename, O_RDWR|O_CREAT, 0640, $DB_BTREE + $x = tie %h, "DB_File", $filename, O_RDWR|O_CREAT, 0666, $DB_BTREE or die "Cannot open $filename: $!\n"; # Add some key/value pairs to the file @@ -1332,7 +1332,7 @@ L for a workaround). unlink $filename ; my @h ; - tie @h, "DB_File", $filename, O_RDWR|O_CREAT, 0640, $DB_RECNO + tie @h, "DB_File", $filename, O_RDWR|O_CREAT, 0666, $DB_RECNO or die "Cannot open file 'text': $!\n" ; # Add a few key/value pairs to the file @@ -1428,7 +1428,7 @@ L). unlink $file ; - $H = tie @h, "DB_File", $file, O_RDWR|O_CREAT, 0640, $DB_RECNO + $H = tie @h, "DB_File", $file, O_RDWR|O_CREAT, 0666, $DB_RECNO or die "Cannot open file $file: $!\n" ; # first create a text file to play with @@ -1848,7 +1848,7 @@ peril! The locking technique went like this. - $db = tie(%db, 'DB_File', '/tmp/foo.db', O_CREAT|O_RDWR, 0644) + $db = tie(%db, 'DB_File', '/tmp/foo.db', O_CREAT|O_RDWR, 0666) || die "dbcreat /tmp/foo.db $!"; $fd = $db->fd; open(DB_FH, "+<&=$fd") || die "dup $!";