diff --git a/src/node_report_utils.cc b/src/node_report_utils.cc index 5013fd7a875216..81fdeda0405ea4 100644 --- a/src/node_report_utils.cc +++ b/src/node_report_utils.cc @@ -192,15 +192,17 @@ void WalkHandle(uv_handle_t* h, void* arg) { if (rc == 0) { writer->json_keyvalue("fd", static_cast(fd_v)); switch (fd_v) { - case 0: + case STDIN_FILENO: writer->json_keyvalue("stdio", "stdin"); break; - case 1: + case STDOUT_FILENO: writer->json_keyvalue("stdio", "stdout"); break; - case 2: + case STDERR_FILENO: writer->json_keyvalue("stdio", "stderr"); break; + default: + break; } } } @@ -231,7 +233,7 @@ std::string EscapeJsonChars(const std::string& str) { "\\u001a", "\\u001b", "\\u001c", "\\u001d", "\\u001e", "\\u001f" }; - std::string ret = ""; + std::string ret; size_t last_pos = 0; size_t pos = 0; for (; pos < str.size(); ++pos) {