diff options
-rw-r--r-- | ext/Storable/Storable.pm | 13 | ||||
-rw-r--r-- | t/lib/st-lock.t | 6 |
2 files changed, 17 insertions, 2 deletions
diff --git a/ext/Storable/Storable.pm b/ext/Storable/Storable.pm index 76c320923b..aada65eea5 100644 --- a/ext/Storable/Storable.pm +++ b/ext/Storable/Storable.pm @@ -118,6 +118,11 @@ sub _store { open(FILE, ">$file") || logcroak "can't create $file: $!"; binmode FILE; # Archaic systems... if ($use_locking) { + if ($^O eq 'dos') { + require Carp; + Carp::carp "Storable::lock_store: fcntl/flock emulation broken on $^O\n"; + return undef; + } flock(FILE, LOCK_EX) || logcroak "can't get exclusive lock on $file: $!"; truncate FILE, 0; @@ -234,7 +239,13 @@ sub _retrieve { my $self; my $da = $@; # Could be from exception handler if ($use_locking) { - flock(FILE, LOCK_SH) || logcroak "can't get shared lock on $file: $!"; + if ($^O eq 'dos') { + require Carp; + Carp::carp "Storable::lock_retrieve: fcntl/flock emulation broken on $^O\n"; + return undef; + } + flock(FILE, LOCK_SH) || + logcroak "can't get shared lock on $file: $!"; # Unlocking will happen when FILE is closed } eval { $self = pretrieve(*FILE) }; # Call C routine diff --git a/t/lib/st-lock.t b/t/lib/st-lock.t index 28fe66490e..1e6ae63ce9 100644 --- a/t/lib/st-lock.t +++ b/t/lib/st-lock.t @@ -12,7 +12,7 @@ sub BEGIN { chdir('t') if -d 't'; - @INC = '.'; + @INC = '.'; push @INC, '../lib'; require Config; import Config; if ($Config{'extensions'} !~ /\bStorable\b/) { @@ -23,6 +23,10 @@ sub BEGIN { print "1..0 # Skip: no flock or flock emulation on this platform\n"; exit 0; } + if ($Config{'osname'} eq 'dos') { + print "1..0 # Skip: fcntl/flock emulation broken on this platform\n"; + exit 0; + } require 'lib/st-dump.pl'; } |