Skip to content

Commit

Permalink
coverity: check return value from dup2 and log error on failure
Browse files Browse the repository at this point in the history
Signed-off-by: Todd Gill <[email protected]>
  • Loading branch information
trgill authored and prajnoha committed Feb 15, 2021
1 parent 65f5af6 commit 0fecd48
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/resource/worker-control.c
Original file line number Diff line number Diff line change
Expand Up @@ -539,7 +539,10 @@ static int _setup_channel(sid_resource_t *owner, const char *alt_id, bool is_wor
}

if (chan->spec->wire.ext.used && chan->spec->wire.ext.pipe.fd_redir >= 0) {
dup2(chan->fd, chan->spec->wire.ext.pipe.fd_redir);
if (dup2(chan->fd, chan->spec->wire.ext.pipe.fd_redir) < 0) {
log_error_errno(id, errno, "Failed to redirect FD %d through channel %s : WORKER_WIRE_SOCKET",
chan->spec->wire.ext.pipe.fd_redir, chan->spec->id);
}
close(chan->fd);
}
break;
Expand Down

0 comments on commit 0fecd48

Please sign in to comment.