Why is this dup failing under BSD?

R

Robert Nicholson

I've been doing the following in order to use flock ie. covert a file
descriptor to a File Handle

my %hash;
my $hash = tie (%hash, 'DB_File', $listsDb, O_RDONLY|O_CREAT, 0644)
or
die "Cannot open $listsDb\n";

my $fd = $hash->fd;
open(DB_FH, "+<&=$fd") or die "dup $!";
flock (DB_FH, LOCK_SH) or die "flock: $!";


under BSD I get an error when I do this.

Can anybody tell me why?
 
J

John W. Krahn

Robert said:
I've been doing the following in order to use flock ie. covert a file
descriptor to a File Handle

my %hash;
my $hash = tie (%hash, 'DB_File', $listsDb, O_RDONLY|O_CREAT, 0644)
or
die "Cannot open $listsDb\n";

my $fd = $hash->fd;
open(DB_FH, "+<&=$fd") or die "dup $!";
flock (DB_FH, LOCK_SH) or die "flock: $!";


under BSD I get an error when I do this.

Patient: Doctor it hurts when I do this.

Doctor: Well, don't do that.

(is BSD always on top?)

Can anybody tell me why?

My ESP tells me ... wait ... I see an error on line 42 ... no ... wait ...
line 15 ... does "line 15" mean anything to you?




John
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top