summaryrefslogtreecommitdiff
blob: 3d473b9810ce04ea2760776c12b55a2344fb04f0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
Common subdirectories: flexbackup-1.2.1-r4/contrib and flexbackup-1.2.1-r5/contrib
diff -ubB flexbackup-1.2.1-r4/flexbackup flexbackup-1.2.1-r5/flexbackup
--- flexbackup-1.2.1-r4/flexbackup	2007-04-14 17:09:48.000000000 -0400
+++ flexbackup-1.2.1-r5/flexbackup	2007-04-14 17:23:20.000000000 -0400
@@ -5276,6 +5276,7 @@
     my $tmp_script = "$cfg::tmpdir/buftest.$host.$PROCESS_ID.sh";
     my $retval = 0;
     my $pipecmd;
+	my $explicit_success;
 
     $buffer_cmd =~ s:^\s*\|\s*::;
     $buffer_cmd =~ s:\s*\|\s*$::;
@@ -5290,7 +5291,7 @@
     print SCR "res=\$?\n";
     print SCR "out=\`cat \$tmp_err\`\n";
     print SCR "if [ \$res -eq 0 ]; then\n";
-    print SCR "   echo successful\n";
+    print SCR "    echo \"successful\"\n";
     print SCR "else\n";
     print SCR "   echo \"unsuccessful: exit code \$res: \$out\" \n";
     print SCR "fi\n";
@@ -5302,13 +5303,19 @@
 	$pipecmd = "sh $tmp_script ";
     } else {
 	print $::msg "| Checking '$cfg::buffer' on host $host... ";
-	$pipecmd =  "cat $tmp_script | ($::remoteshell $host 'cat > $tmp_script; sh $tmp_script; rm -f $tmp_script')";
+	$pipecmd =  "$::remoteshell $host '$::path{mkdir} -p $cfg::tmpdir'; cat $tmp_script | ($::remoteshell $host 'cat > $tmp_script; sh $tmp_script; rm -rf $cfg::tmpdir')";
     }
 
     if (!defined($::debug)) {
 
 	open(PIPE,"$pipecmd |") || die;
+
+	$explicit_success = 0;
 	while (<PIPE>) {
+		if (/^successful$/) {
+			$explicit_success = 1;
+			last;
+		}
 	    if (/^unsuccessful: exit code (\d+): (.*)/) {
 		$retval = $1;
 		my $out = $2;
@@ -5337,11 +5344,15 @@
 	print $::msg "\n(debug) $pipecmd\n";
     }
 
-    if ($retval == 0) {
+	if ($explicit_success) {
 	print $::msg "Ok\n";
     }  else {
+		if ($retval == 0) {
+		    push(@::errors, "Unanticipated problems encountered testing '$cfg::buffer' on host '$host'.");
+		}  else {
 	print $::msg "Failed!\n";
     }
+	}
     unlink("$tmp_script");
 
     return($retval);