mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
io.c (rb_update_max_fd): fail with a negative file descripter
Coverity Scan points out that ext/socket/unixsocket.c may pass -1 to rb_update_max_fd. I'm unsure whether it can happen actually or not, but it would be good for the function to reject a negative value.
This commit is contained in:
parent
ebc2198d9f
commit
90b9900dc1
1 changed files with 1 additions and 1 deletions
2
io.c
2
io.c
|
@ -201,7 +201,7 @@ rb_update_max_fd(int fd)
|
||||||
rb_atomic_t max_fd = max_file_descriptor;
|
rb_atomic_t max_fd = max_file_descriptor;
|
||||||
int err;
|
int err;
|
||||||
|
|
||||||
if (afd <= max_fd)
|
if (fd < 0 || afd <= max_fd)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
#if defined(HAVE_FCNTL) && defined(F_GETFL)
|
#if defined(HAVE_FCNTL) && defined(F_GETFL)
|
||||||
|
|
Loading…
Reference in a new issue