Imported Upstream version 3.2.0
[debian/amanda] / perl / Amanda / Changer / disk.pm
index b31ad54b64fa666a4f1d3ebd4787f4e6256ede0e..e633c451385e6c8715157bbe76011bbe6f76a351 100644 (file)
@@ -325,7 +325,7 @@ sub _alloc_drive {
 }
 
 # Internal function to enumerate all available slots.  Slots are described by
-# integers.
+# strings.
 sub _all_slots {
     my ($self) = @_;
     my $dir = _quote_glob($self->{'dir'});
@@ -337,7 +337,7 @@ sub _all_slots {
        push @slots, $slot + 0;
     }
 
-    return sort @slots;
+    return map { "$_"} sort { $a <=> $b } @slots;
 }
 
 # Internal function to determine whether a slot exists.
@@ -376,7 +376,7 @@ sub _is_slot_in_use {
 
            #check if process is alive
            my $pid = $state->{drives}->{$drive}->{pid};
-           if (defined $pid && !Amanda::Util::is_pid_alive($pid)) {
+           if (!defined $pid or !Amanda::Util::is_pid_alive($pid)) {
                unlink("$drive/data")
                    or warn("Could not unlink '$drive/data': $!");
                rmdir("$drive")