Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 262d798b authored by Ben Chan's avatar Ben Chan Committed by chrome-internal-fetch
Browse files

crash-reporter: Replace NULL with nullptr.

BUG=None
TEST=`FEATURES=test emerge-$BOARD crash-reporter`

Change-Id: If0804613ee0385752d01f7bbe01902ffef53bd94
Reviewed-on: https://chromium-review.googlesource.com/218870


Reviewed-by: default avatarAlex Vakulenko <avakulenko@chromium.org>
Commit-Queue: Ben Chan <benchan@chromium.org>
Tested-by: default avatarBen Chan <benchan@chromium.org>
parent 732bd3bb
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -45,7 +45,7 @@ bool GetDelimitedString(const std::string &str, char ch, size_t offset,
bool GetDriErrorState(const chromeos::dbus::Proxy &proxy,
                      const FilePath &error_state_path) {
  chromeos::glib::ScopedError error;
  gchar *error_state = NULL;
  gchar *error_state = nullptr;
  if (!dbus_g_proxy_call(proxy.gproxy(), debugd::kGetLog,
                         &chromeos::Resetter(&error).lvalue(),
                         G_TYPE_STRING, "i915_error_state", G_TYPE_INVALID,
@@ -150,12 +150,12 @@ bool ChromeCollector::HandleCrash(const FilePath &file_path,
  FilePath dir;
  uid_t uid = atoi(uid_string.c_str());
  pid_t pid = atoi(pid_string.c_str());
  if (!GetCreatedCrashDirectoryByEuid(uid, &dir, NULL)) {
  if (!GetCreatedCrashDirectoryByEuid(uid, &dir, nullptr)) {
    LOG(ERROR) << "Can't create crash directory for uid " << uid;
    return false;
  }

  std::string dump_basename = FormatDumpBasename(exe_name, time(NULL), pid);
  std::string dump_basename = FormatDumpBasename(exe_name, time(nullptr), pid);
  FilePath meta_path = GetCrashPath(dir, dump_basename, "meta");
  FilePath minidump_path = GetCrashPath(dir, dump_basename, "dmp");
  FilePath log_path = GetCrashPath(dir, dump_basename, "log.tar.xz");
+9 −9
Original line number Diff line number Diff line
@@ -88,8 +88,8 @@ CrashCollector::~CrashCollector() {
void CrashCollector::Initialize(
    CrashCollector::CountCrashFunction count_crash_function,
    CrashCollector::IsFeedbackAllowedFunction is_feedback_allowed_function) {
  CHECK(count_crash_function != NULL);
  CHECK(is_feedback_allowed_function != NULL);
  CHECK(count_crash_function);
  CHECK(is_feedback_allowed_function);

  count_crash_function_ = count_crash_function;
  is_feedback_allowed_function_ = is_feedback_allowed_function;
@@ -156,7 +156,7 @@ const char *GetGErrorMessage(const GError *error) {
}

GHashTable *CrashCollector::GetActiveUserSessions() {
  GHashTable *active_sessions = NULL;
  GHashTable *active_sessions = nullptr;

  chromeos::dbus::BusConnection dbus = chromeos::dbus::GetSystemBusConnection();
  if (!dbus.HasConnection()) {
@@ -174,7 +174,7 @@ GHashTable *CrashCollector::GetActiveUserSessions() {
  }

  // Request all the active sessions.
  GError *gerror = NULL;
  GError *gerror = nullptr;
  if (!dbus_g_proxy_call(proxy.gproxy(),
                         login_manager::kSessionManagerRetrieveActiveSessions,
                         &gerror, G_TYPE_INVALID,
@@ -243,10 +243,10 @@ bool CrashCollector::GetUserInfoFromName(const std::string &name,
                                         gid_t *gid) {
  char storage[256];
  struct passwd passwd_storage;
  struct passwd *passwd_result = NULL;
  struct passwd *passwd_result = nullptr;

  if (getpwnam_r(name.c_str(), &passwd_storage, storage, sizeof(storage),
                 &passwd_result) != 0 || passwd_result == NULL) {
                 &passwd_result) != 0 || passwd_result == nullptr) {
    LOG(ERROR) << "Cannot find user named " << name;
    return false;
  }
@@ -262,7 +262,7 @@ bool CrashCollector::GetCreatedCrashDirectoryByEuid(uid_t euid,
  uid_t default_user_id;
  gid_t default_user_group;

  if (out_of_capacity != NULL) *out_of_capacity = false;
  if (out_of_capacity) *out_of_capacity = false;

  // For testing.
  if (!forced_crash_directory_.empty()) {
@@ -308,7 +308,7 @@ bool CrashCollector::GetCreatedCrashDirectoryByEuid(uid_t euid,
  }

  if (!CheckHasCapacity(*crash_directory)) {
    if (out_of_capacity != NULL) *out_of_capacity = true;
    if (out_of_capacity) *out_of_capacity = true;
    return false;
  }

@@ -386,7 +386,7 @@ bool CrashCollector::CheckHasCapacity(const FilePath &crash_directory) {
  struct dirent* ent;
  bool full = false;
  std::set<std::string> basenames;
  while (readdir_r(dir, &ent_buf, &ent) == 0 && ent != NULL) {
  while (readdir_r(dir, &ent_buf, &ent) == 0 && ent) {
    if ((strcmp(ent->d_name, ".") == 0) ||
        (strcmp(ent->d_name, "..") == 0))
      continue;
+1 −1
Original line number Diff line number Diff line
@@ -91,7 +91,7 @@ class CrashCollector {

  // Determines the crash directory for given euid, and creates the
  // directory if necessary with appropriate permissions.  If
  // |out_of_capacity| is not NULL, it is set to indicate if the call
  // |out_of_capacity| is not nullptr, it is set to indicate if the call
  // failed due to not having capacity in the crash directory. Returns
  // true whether or not directory needed to be created, false on any
  // failure.  If the crash directory is at capacity, returns false.
+1 −1
Original line number Diff line number Diff line
@@ -172,7 +172,7 @@ static int HandleUserCrash(UserCollector *user_collector) {
  // Accumulate logs to help in diagnosing failures during user collection.
  chromeos::LogToString(true);
  // Handle the crash, get the name of the process from procfs.
  bool handled = user_collector->HandleCrash(FLAGS_user, NULL);
  bool handled = user_collector->HandleCrash(FLAGS_user, nullptr);
  chromeos::LogToString(false);
  if (!handled)
    return 1;
+4 −3
Original line number Diff line number Diff line
@@ -236,7 +236,8 @@ void KernelCollector::StripSensitiveData(std::string *kernel_dump) {
}

bool KernelCollector::Enable() {
  if (arch_ == kArchUnknown || arch_ >= kArchCount || kPCRegex[arch_] == NULL) {
  if (arch_ == kArchUnknown || arch_ >= kArchCount ||
      kPCRegex[arch_] == nullptr) {
    LOG(WARNING) << "KernelCollector does not understand this architecture";
    return false;
  }
@@ -519,12 +520,12 @@ bool KernelCollector::Collect() {

    if (!GetCreatedCrashDirectoryByEuid(kRootUid,
                                        &root_crash_directory,
                                        NULL)) {
                                        nullptr)) {
      return true;
    }

    std::string dump_basename =
        FormatDumpBasename(kKernelExecName, time(NULL), kKernelPid);
        FormatDumpBasename(kKernelExecName, time(nullptr), kKernelPid);
    FilePath kernel_crash_path = root_crash_directory.Append(
        StringPrintf("%s.kcrash", dump_basename.c_str()));

Loading