chiark / gitweb /
show mt runes; bugfixes from lalonde
[chiark-utils.git] / backup / increm
index bc058f7f7ffe0f44c1bf0300eb92696448f5382b..f2cb7b4814b30e8b4ffaddfe9e6f1a7272c552b1 100755 (executable)
@@ -61,22 +61,22 @@ close A or die $!;
 # better be a decimal number
 $advance =~ m/^\d+$/ or die "$advance ?";
 
+# Get a list of all filesystems
+readfsys('all');
+openlog();
+
 # Rewind the tape and if we are the first incremental on the tape then
 # write the TAPEID record, otherwise skip forward to the correct point.
 # (full will already have checked that this is the right tape before
 # it invoked us, so no need to read the existing TAPEID record first.)
-system "mt -f $ntape rewind"; $? and die $?;
+runsystem("mt -f $ntape rewind");
 if ($advance == 1) {
     writetapeid($tapeid,$tapedesc);
 } else {
-    system "mt -f $ntape fsf $advance"; $? and die $?;
-    $currenttapefilenumber= $advance+1;
+    runsystem("mt -f $ntape fsf $advance");
+    $currenttapefilenumber= $advance;
 }
 
-# Get a list of all filesystems
-readfsys('all');
-openlog();
-
 sub closepipes () {
     close(DUMPOR); close(BUFOR);
     close(DUMPOW); close(BUFOW);
@@ -128,7 +128,7 @@ for $tf (@fsys) {
 }
 
 # Rewind the tape, and increment the counter of incremental backups.
-system "mt -f $tape rewind"; $? and die $?;
+runsystem("mt -f $tape rewind");
 open IAN,">increm-advance.new" or die $!;
 print IAN "$advance\n" or die $!;
 close IAN or die $!;