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 committed Jul 18, 2018
1 parent e9b22e9 commit 7b6e2fc
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 7b6e2fc

Please sign in to comment.