From 845a6214f842f3a5220f4bf4f209c0f5b25d48b5 Mon Sep 17 00:00:00 2001 From: gengjiawen Date: Tue, 9 Apr 2019 22:46:33 +0800 Subject: [PATCH] src: use macro instead of magic number for fd PR-URL: https://github.com/nodejs/node/pull/27152 Reviewed-By: Richard Lau Reviewed-By: Refael Ackermann Reviewed-By: Colin Ihrig Reviewed-By: James M Snell --- src/node_report_utils.cc | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/node_report_utils.cc b/src/node_report_utils.cc index 5013fd7a875216..23d18fab99f54b 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; } } }