Skip to content

Commit

Permalink
src: avoid unnecessarily formatting a warning
Browse files Browse the repository at this point in the history
ProcessEmitWarning will already format the message, there is no
need to call snprintf here.

PR-URL: #21832
Reviewed-By: Anatoli Papirovski <apapirovski@mac.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Gus Caplan <me@gus.host>
Reviewed-By: Tiancheng "Timothy" Gu <timothygu99@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
  • Loading branch information
tniessen authored and targos committed Jul 19, 2018
1 parent 0f70017 commit c45623a
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions src/node_file.cc
Original file line number Diff line number Diff line change
Expand Up @@ -172,13 +172,11 @@ inline void FileHandle::Close() {
// to notify that the file descriptor was gc'd. We want to be noisy about
// this because not explicitly closing the FileHandle is a bug.
env()->SetUnrefImmediate([](Environment* env, void* data) {
char msg[70];
err_detail* detail = static_cast<err_detail*>(data);
snprintf(msg, arraysize(msg),
"Closing file descriptor %d on garbage collection",
detail->fd);
ProcessEmitWarning(env,
"Closing file descriptor %d on garbage collection",
detail->fd);
delete detail;
ProcessEmitWarning(env, msg);
}, detail);
}

Expand Down

0 comments on commit c45623a

Please sign in to comment.