Blob Blame History Raw
From 7f10ea89c30944fc60a95d53e544caa005c03e0e Mon Sep 17 00:00:00 2001
From: Mark Reynolds <mreynolds@redhat.com>
Date: Mon, 6 Jul 2015 15:55:43 -0400
Subject: [PATCH] Ticket 48119 - setup-ds.pl does not log invalid --file path
 errors the same way as other errors.

Bug Description:  Errors occuring from Inf.pm are only written to STDERR

Fix Description:  Write errors from Inf.pm using the debug function

https://fedorahosted.org/389/ticket/48119

Reviewed by: nhosoi(Thanks!)

(cherry picked from commit 6306fc4e8eb2fb5973360f550c83e3c9b220df5c)
(cherry picked from commit 5bd7119d8529e1c0b763c45e3ec7d1fb497da6c8)
---
 ldap/admin/src/scripts/Inf.pm | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/ldap/admin/src/scripts/Inf.pm b/ldap/admin/src/scripts/Inf.pm
index 98649ac..ec433e2 100644
--- a/ldap/admin/src/scripts/Inf.pm
+++ b/ldap/admin/src/scripts/Inf.pm
@@ -12,6 +12,7 @@
 
 package Inf;
 
+use DSUtil;
 use File::Temp qw(tempfile tempdir);
 
 #require    Exporter;
@@ -59,7 +60,7 @@ sub read {
         $inffh = \*STDIN;
     } else {
         if (!open(INF, $filename)) {
-            print STDERR "Error: could not open inf file $filename: $!\n";
+            debug(0, "Error: could not open inf file $filename: $!\n");
             return;
         }
         $inffh = \*INF;
@@ -124,7 +125,7 @@ sub section {
     my $key = shift;
 
     if (!exists($self->{$key})) {
-        print "Error: unknown inf section $key\n";
+        debug(0, "Error: unknown inf section $key\n");
         return undef;
     }
 
@@ -187,7 +188,7 @@ sub write {
     my $savemask = umask(0077);
     if (!$fh) {
         if (!open(INF, ">$filename")) {
-            print STDERR "Error: could not write inf file $filename: $!\n";
+            debug(0, "Error: could not write inf file $filename: $!\n");
             umask($savemask);
             return;
         }
@@ -232,7 +233,7 @@ sub updateFromArgs {
                 $argsinf->{$sec}->{$parm} = $val;
             }
         } else { # error
-            print STDERR "Error: unknown command line option $arg\n";
+            debug(0, "Error: unknown command line option $arg\n");
             return;
         }
     }
-- 
1.9.3