Minor improvements to FD_SETSIZE overflow checks.

* src/process.c (Fmake_serial_process): Add port to error data.
(connect_network_socket): Add an explanatory comment.
This commit is contained in:
Philipp Stephani 2020-12-30 22:36:07 +01:00
parent 8bc85d46cc
commit 0eef70aea8

View file

@ -3068,7 +3068,7 @@ usage: (make-serial-process &rest ARGS) */)
fd = serial_open (port);
p->open_fd[SUBPROCESS_STDIN] = fd;
if (FD_SETSIZE <= fd)
report_file_errno ("Opening serial port", Qnil, EMFILE);
report_file_errno ("Opening serial port", port, EMFILE);
p->infd = fd;
p->outfd = fd;
if (fd > max_desc)
@ -3332,6 +3332,7 @@ connect_network_socket (Lisp_Object proc, Lisp_Object addrinfos,
xerrno = errno;
continue;
}
/* Reject file descriptors that would be too large. */
if (FD_SETSIZE <= s)
{
emacs_close (s);