From 7e260dca94ffa3840f22f5675ee8bc1cb03ecf70 Mon Sep 17 00:00:00 2001
From: chrfranke <chrfranke@4ea69e1a-61f1-4043-bf83-b5c94c648137>
Date: Thu, 22 Oct 2009 18:53:12 +0000
Subject: [PATCH] smartctl: Use printf() instead of pout() for exception error
 messages to avoid access to bogus 'con->dont_print'.

git-svn-id: https://smartmontools.svn.sourceforge.net/svnroot/smartmontools/trunk@2962 4ea69e1a-61f1-4043-bf83-b5c94c648137
---
 smartmontools/CHANGELOG    | 3 +++
 smartmontools/smartctl.cpp | 4 ++--
 2 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/smartmontools/CHANGELOG b/smartmontools/CHANGELOG
index 216ff1636..824a63c5c 100644
--- a/smartmontools/CHANGELOG
+++ b/smartmontools/CHANGELOG
@@ -43,6 +43,9 @@ NOTES FOR FUTURE RELEASES: see TODO file.
 
 <DEVELOPERS: ADDITIONS TO THE CHANGE LOG GO JUST BELOW HERE, PLEASE>
 
+  [CF] smartctl: Use printf() instead of pout() for exception error
+       messages to avoid access to bogus 'con->dont_print'.
+
   [CF] smartd: Add missing help texts for '-A', '-B' and '-s'.
 
   [CF] Add missing check for log page 0x11 support to smartctl
diff --git a/smartmontools/smartctl.cpp b/smartmontools/smartctl.cpp
index 545a41f31..e0f48c6fa 100644
--- a/smartmontools/smartctl.cpp
+++ b/smartmontools/smartctl.cpp
@@ -981,12 +981,12 @@ int main(int argc, char **argv)
   }
   catch (const std::bad_alloc & /*ex*/) {
     // Memory allocation failed (also thrown by std::operator new)
-    pout("Smartctl: Out of memory\n");
+    printf("Smartctl: Out of memory\n");
     status = FAILCMD;
   }
   catch (const std::exception & ex) {
     // Other fatal errors
-    pout("Smartctl: Exception: %s\n", ex.what());
+    printf("Smartctl: Exception: %s\n", ex.what());
     status = FAILCMD;
   }
   return status;
-- 
GitLab