OSDN Git Service

osi: Update error messages
authorMyles Watson <mylesgw@google.com>
Tue, 21 Mar 2017 17:28:20 +0000 (10:28 -0700)
committerMyles Watson <mylesgw@google.com>
Tue, 28 Mar 2017 20:44:17 +0000 (13:44 -0700)
Test: build
Change-Id: I5af34f01c47d8037d56c27e7e3fab3cc2f5fd2bc

osi/src/osi.cc
osi/src/thread.cc
osi/src/wakelock.cc

index 78f83f8..0109a95 100644 (file)
@@ -39,7 +39,7 @@ int osi_rand(void) {
   if (rand_fd == INVALID_FD) {
     LOG_ERROR(LOG_TAG, "%s can't open rand fd %s: %s ", __func__, RANDOM_PATH,
               strerror(errno));
-    CHECK(0);
+    CHECK(rand_fd != INVALID_FD);
   }
 
   ssize_t read_bytes = read(rand_fd, &rand, sizeof(rand));
index 586ba7e..d218129 100644 (file)
@@ -191,7 +191,7 @@ static void* run_thread(void* start_arg) {
   }
   thread->tid = gettid();
 
-  LOG_WARN(LOG_TAG, "%s: thread id %d, thread name %s started", __func__,
+  LOG_INFO(LOG_TAG, "%s: thread id %d, thread name %s started", __func__,
            thread->tid, thread->name);
 
   semaphore_post(start->start_sem);
index b7e5037..565735f 100644 (file)
@@ -33,6 +33,7 @@
 #include <mutex>
 #include <string>
 
+#include "base/logging.h"
 #include "osi/include/alarm.h"
 #include "osi/include/allocator.h"
 #include "osi/include/log.h"
@@ -198,6 +199,7 @@ static void wakelock_initialize_native(void) {
   if (wake_lock_fd == INVALID_FD) {
     LOG_ERROR(LOG_TAG, "%s can't open wake lock %s: %s", __func__,
               wake_lock_path.c_str(), strerror(errno));
+    CHECK(wake_lock_fd != INVALID_FD);
   }
 
   if (wake_unlock_path.empty()) wake_unlock_path = DEFAULT_WAKE_UNLOCK_PATH;
@@ -206,6 +208,7 @@ static void wakelock_initialize_native(void) {
   if (wake_unlock_fd == INVALID_FD) {
     LOG_ERROR(LOG_TAG, "%s can't open wake unlock %s: %s", __func__,
               wake_unlock_path.c_str(), strerror(errno));
+    CHECK(wake_unlock_fd != INVALID_FD);
   }
 }