eliminate gratuitious comment change in source code
[debian/amanda] / application-src / amraw.pl
index 0c947e87c2a36a636fd399968c7100ccdf844f1a..198758646a0029995f118ee7c1cc002231e14b4e 100644 (file)
@@ -1,5 +1,5 @@
 #!@PERL@ 
-# Copyright (c) 2009 Zmanda, Inc.  All Rights Reserved.
+# Copyright (c) 2009-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
@@ -19,6 +19,7 @@
 
 use lib '@amperldir@';
 use strict;
+use warnings;
 use Getopt::Long;
 
 package Amanda::Application::Amraw;
@@ -29,7 +30,7 @@ use Symbol;
 use IO::Handle;
 use Amanda::Constants;
 use Amanda::Debug qw( :logging );
-use Amanda::Util;
+use Amanda::Util qw( quote_string );
 
 sub new {
     my $class = shift;
@@ -82,8 +83,16 @@ sub command_support {
 sub command_selfcheck {
     my $self = shift;
 
-    print "OK " . $self->{disk} . "\n";
-    print "OK " . $self->{device} . "\n";
+    $self->print_to_server("disk " . quote_string($self->{disk}),
+                          $Amanda::Script_App::GOOD)
+               if defined $self->{disk};
+
+    $self->print_to_server("amraw version " . $Amanda::Constants::VERSION,
+                          $Amanda::Script_App::GOOD);
+
+    $self->print_to_server(quote_string($self->{device}),
+                          $Amanda::Script_App::GOOD)
+               if defined $self->{device};
 
     if (! -r $self->{device}) {
        $self->print_to_server("$self->{device} can't be read",
@@ -158,11 +167,6 @@ sub command_backup {
     my $self = shift;
 
     my $level = $self->{level}[0];
-    my $mesgout_fd;
-    open($mesgout_fd, '>&=3') ||
-       $self->print_to_server_and_die("Can't open mesgout_fd: $!",
-                                      $Amanda::Script_App::ERROR);
-    $self->{mesgout} = $mesgout_fd;
 
     if (defined($self->{index})) {
        $self->{'index_out'} = IO::Handle->new_from_fd(4, 'w');
@@ -207,8 +211,8 @@ sub command_backup {
        if ($ksize < 32) {
            $ksize = 32;
        }
-       print $mesgout_fd "sendbackup: size $ksize\n";
-       print $mesgout_fd "sendbackup: end\n";
+       print {$self->{mesgout}} "sendbackup: size $ksize\n";
+       print {$self->{mesgout}} "sendbackup: end\n";
     }
 
     exit 0;