[Tool] fixed checking of dlopen failure into tizen_2.4
authorAndrzej Popowski <a.popowski@samsung.com>
Fri, 16 Oct 2015 11:31:55 +0000 (13:31 +0200)
committerAndrzej Popowski <a.popowski@samsung.com>
Fri, 16 Oct 2015 11:31:55 +0000 (13:31 +0200)
Change-Id: I8d76b51da9a11e60f3a2375530c5877b68e32596
Signed-off-by: Andrzej Popowski <a.popowski@samsung.com>
src/tool/desc_gentool.cc

index 69fc6ceb2fcccf58a95de7212766d44d1ef65212..e0570ef9892e45a69c0614ce2d0a7678ea2fe764 100644 (file)
@@ -170,11 +170,11 @@ int main(int argc, char* argv[]) {
           !fname.compare(fname.size() - postfix_.size(), postfix_.size(),
                         postfix_)) {
         std::string so_path = tce_path + "/" + fname;
-        char* error;
         void *handle = dlopen(so_path.c_str(), RTLD_LAZY);
-        if ((error = dlerror()) != NULL) {
+        if (handle == NULL) {
           std::cerr << "cannot open " << so_path << std::endl;
-          std::cerr << "Error >>" << error << std::endl;
+          char* error = dlerror();
+          std::cerr << "Error >>" << ((error == NULL) ? "NULL" : error) << std::endl;
           return -1;
         }
 
@@ -212,6 +212,4 @@ int main(int argc, char* argv[]) {
 
   // it would be need for ignore loaded libraries destructor
   _exit(0);
-
-  return 0;
 }