Fixes for signedness warnings noticed by VMSperlers.
[p5sagit/p5-mst-13.2.git] / ext / Storable / Storable.pm
index 7b46317..d2a631c 100644 (file)
@@ -135,7 +135,10 @@ sub _store {
        open(FILE, ">$file") || logcroak "can't create $file: $!";
        binmode FILE;                           # Archaic systems...
        if ($use_locking) {
-               if ($^O eq 'dos') {
+               require Config; import Config;
+               if (!$Config{'d_flock'} &&
+                   !$Config{'d_fcntl_can_lock'} &&
+                   !$Config{'d_lockf'}) {
                        logcarp "Storable::lock_store: fcntl/flock emulation broken on $^O";
                        return undef;
                }
@@ -255,11 +258,15 @@ sub _retrieve {
        my $self;
        my $da = $@;                                                    # Could be from exception handler
        if ($use_locking) {
-               if ($^O eq 'dos') {
-                       logcarp "Storable::lock_store: fcntl/flock emulation broken on $^O";
+               require Config; import Config;
+               if (!$Config{'d_flock'} &&
+                   !$Config{'d_fcntl_can_lock'} &&
+                   !$Config{'d_lockf'}) {
+                       logcarp "Storable::lock_retrieve: fcntl/flock emulation broken on $^O";
                        return undef;
                }
-               flock(FILE, LOCK_SH) || logcroak "can't get shared lock on $file: $!";
+               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