[patch][4.0.0alpha3] switch to cmdSystemOrEvalLong in BackupPC_rrdUpdate

Alexander Moisseev <[email protected]> Tue, 10 Dec 2013 11:38:59 +0400
Newsgroups gmane.comp.sysutils.backup.backuppc.devel
Message-ID <[email protected]>
Switch to cmdSystemOrEvalLong from cmdSystemOrEval when getting stdout because sub cmdSystemOrEval merges stdout and stderr together.

BackupPC_rrdUpdate creates broken images if HOME environment variable set to path non-readable by backuppc user (e.g. HOME=/root).
BackupPC_rrdUpdate writes stderr warnings in image files:
"(process:2430): Pango-WARNING **: error opening config file '/root/.config/pango/pangorc': Permission denied".


diff -ruN ./BackupPC_rrdUpdate.orig ./BackupPC_rrdUpdate
--- ./BackupPC_rrdUpdate.orig   2013-12-09 17:06:45.000000000 +0400
+++ ./BackupPC_rrdUpdate        2013-12-10 11:22:05.000000000 +0400
@@ -140,7 +140,7 @@
      #
      # Get each pool max value from RRD
      #
-    $bpc->cmdSystemOrEval(
+    $bpc->cmdSystemOrEvalLong(
              [
                  $Conf{RrdToolPath},
                  "graphv", "-",
@@ -158,7 +158,7 @@
                  if ( $_[0] =~ /^print\[([0-3])\] = "([.0-9]+)"$/ ) {
                      $poolMax[$1] = $2 unless ( $2 == 0 );
                  }
-            });
+            }, 0, undef);

      my $poolSizeGraph = [
          "$Conf{RrdToolPath}",
@@ -228,6 +228,6 @@
          print("Can't open/create $LogDir/poolUsage$weeks.png\n");
          return;
      }
-    $bpc->cmdSystemOrEval($poolSizeGraph, sub { print $fdOut $_[0] });
+    $bpc->cmdSystemOrEvalLong($poolSizeGraph, sub { print $fdOut $_[0] }, 1, undef);
      close($fdOut);
  }

--
Alexander

------------------------------------------------------------------------------
Sponsored by Intel(R) XDK 
Develop, test and display web and hybrid apps with a single code base.
Download it for free now!
http://pubads.g.doubleclick.net/gampad/clk?id=111408631&iu=/4140/ostg.clktrk
_______________________________________________
BackupPC-devel mailing list
[email protected]
List:    https://lists.sourceforge.net/lists/listinfo/backuppc-devel
Wiki:    http://backuppc.wiki.sourceforge.net
Project: http://backuppc.sourceforge.net/