Skip to content
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
lib: coerce -0 into 0 for process APIs
Fixes: #32750
  • Loading branch information
HarshithaKP committed Apr 14, 2020
commit c2dfd0298445cbc71052d7ab600fb1e4c46a3e56
3 changes: 3 additions & 0 deletions lib/internal/bootstrap/switches/does_own_process_state.js
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,9 @@ function wrapPosixCredentialSetters(credentials) {
function wrapIdSetter(type, method) {
return function(id) {
validateId(id, 'id');
// Coerce -0 into 0, because that is the most reasonable thing
// for system calls
if (id === -0) id = 0;
// Result is 0 on success, 1 if credential is unknown.
const result = method(id);
Comment thread
himself65 marked this conversation as resolved.
Outdated
if (result === 1) {
Expand Down