Imported Upstream version 3.3.3
[debian/amanda] / perl / Amanda / Tapelist.swg
index 0ce1987bb8e94e4ec189a154180649ed1f6662a3..dff9b86177670c29bc87d27f932f68c1eb925de7 100644 (file)
@@ -1,9 +1,10 @@
 /*
  * Copyright (c) 2008-2012 Zmanda, Inc.  All Rights Reserved.
  *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 as published
- * by the Free Software Foundation.
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
  *
  * This program is distributed in the hope that it will be useful, but
  * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
@@ -228,12 +229,14 @@ sub _read_tapelist {
     open(my $fh, "<", $self->{'filename'}) or return $self;
     while (my $line = <$fh>) {
        my ($datestamp, $label, $reuse, $barcode, $meta, $blocksize, $comment)
-           = $line =~ m/^([0-9]*)\s([^\s]*)\s(reuse|no-reuse)\s*(?:BARCODE:([^\s]*))?\s*(?:META:([^\s]*))?\s*(?:BLOCKSIZE:([^\s]*))?\s*(?:\#(.*))?$/mx;
-       next if !defined $datestamp; # silently filter out bogus lines
+           = $line =~ m/^([0-9]+)\s*([^\s]*)\s*(?:(reuse|no-reuse))?\s*(?:BARCODE:([^\s]*))?\s*(?:META:([^\s]*))?\s*(?:BLOCKSIZE:([^\s]*))?\s*(?:\#(.*))?$/mx;
+       if (!defined $datestamp) {
+           Amanda::Debug::critical("Bogus line in the tapelist ($self->{'filename'}) file: $line");
+       }
        push @tles, {
            'datestamp' => $datestamp,
            'label' => $label,
-           'reuse' => ($reuse eq 'reuse'),
+           'reuse' => (!defined $reuse || $reuse eq 'reuse'),
            'barcode' => $barcode,
            'meta' => $meta,
            'blocksize' => $blocksize,