Log chsgen errors to stderr instead of journal 96/36796/1
authorLukasz Wojciechowski <l.wojciechow@partner.samsung.com>
Fri, 13 Mar 2015 13:33:16 +0000 (14:33 +0100)
committerLukasz Wojciechowski <l.wojciechow@partner.samsung.com>
Fri, 13 Mar 2015 13:33:16 +0000 (14:33 +0100)
This patch allows not to use libcynara-commons in chsgen
anymore.

Change-Id: I051b9a300c19c2f99228573d6e30ea8a1af2f323

src/chsgen/CMakeLists.txt
src/chsgen/ChecksumGenerator.cpp

index 748d950..865a9ba 100644 (file)
@@ -21,6 +21,7 @@ SET(CHSGEN_PATH ${CYNARA_PATH}/chsgen)
 SET(CHSGEN_SOURCES
     ${CHSGEN_PATH}/ChecksumGenerator.cpp
     ${CHSGEN_PATH}/main.cpp
+    ${CYNARA_PATH}/common/config/PathConfig.cpp
     )
 
 INCLUDE_DIRECTORIES(
@@ -31,7 +32,6 @@ INCLUDE_DIRECTORIES(
 ADD_EXECUTABLE(${TARGET_CHSGEN} ${CHSGEN_SOURCES})
 
 TARGET_LINK_LIBRARIES(${TARGET_CHSGEN}
-    ${TARGET_CYNARA_COMMON}
     crypt
     )
 
index fcc76dc..0037c08 100644 (file)
@@ -33,7 +33,6 @@
 #include <config/PathConfig.h>
 #include <exceptions/FileNotFoundException.h>
 #include <exceptions/UnexpectedErrorException.h>
-#include <log/log.h>
 
 #include "ChecksumGenerator.h"
 
@@ -83,9 +82,11 @@ const std::string ChecksumGenerator::generate(const std::string &data) {
     } else {
         int err = errno;
         if (err == ENOSYS) {
-            LOGE("'crypt' function was not implemented; error [%d] : <%s>", err, strerror(err));
+            std::cerr << "'crypt' function was not implemented; error [" << err << "] : <"
+                << strerror(err) << ">" << std::endl;
         } else {
-            LOGE("'crypt' function error [%d] : <%s>", err, strerror(err));
+            std::cerr << "'crypt' function error [" << err << "] : <" << strerror(err) << ">"
+                << std::endl;
         }
         throw UnexpectedErrorException(err, strerror(err));
     }
@@ -109,8 +110,8 @@ void ChecksumGenerator::copyFileStream(void) {
 void ChecksumGenerator::printRecord(void) const {
     std::unique_ptr<char, decltype(free)*> pathnameDuplicate(strdup(m_pathname.c_str()), free);
     if (pathnameDuplicate == nullptr) {
-        LOGE("Insufficient memory available to allocate duplicate filename: <%s>",
-             m_pathname.c_str());
+        std::cerr << "Insufficient memory available to allocate duplicate filename: <"
+            << m_pathname << ">" << std::endl;
         throw std::bad_alloc();
     }