summaryrefslogtreecommitdiffstats
path: root/input
diff options
context:
space:
mode:
authorreimar <reimar@b3059339-0415-0410-9bf9-f77b7e298cf2>2007-08-25 07:08:49 +0000
committerreimar <reimar@b3059339-0415-0410-9bf9-f77b7e298cf2>2007-08-25 07:08:49 +0000
commitfde163a48fc1e2879303482839569ae391b2dc2d (patch)
treeb5c55e3932459663eeb7f56ea39cd9a2ca68e7aa /input
parent8adf56e9a3a68b9197291b7eebc02cf92558c726 (diff)
downloadmpv-fde163a48fc1e2879303482839569ae391b2dc2d.tar.bz2
mpv-fde163a48fc1e2879303482839569ae391b2dc2d.tar.xz
HACK: check added fds for validity because otherwise mplayer
crashes due to using FD_SET on -1 git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@24156 b3059339-0415-0410-9bf9-f77b7e298cf2
Diffstat (limited to 'input')
-rw-r--r--input/input.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/input/input.c b/input/input.c
index ab33c411e8..4a49312571 100644
--- a/input/input.c
+++ b/input/input.c
@@ -600,6 +600,10 @@ mp_input_add_cmd_fd(int fd, int select, mp_cmd_func_t read_func, mp_close_func_t
mp_msg(MSGT_INPUT,MSGL_ERR,MSGTR_INPUT_INPUT_ErrCantRegister2ManyCmdFds,fd);
return 0;
}
+ if (fd < 0) {
+ mp_msg(MSGT_INPUT, MSGL_ERR, "Invalid fd %i in mp_input_add_cmd_fd", fd);
+ return 0;
+ }
memset(&cmd_fds[num_cmd_fd],0,sizeof(mp_input_fd_t));
cmd_fds[num_cmd_fd].fd = fd;
@@ -655,6 +659,10 @@ mp_input_add_key_fd(int fd, int select, mp_key_func_t read_func, mp_close_func_t
mp_msg(MSGT_INPUT,MSGL_ERR,MSGTR_INPUT_INPUT_ErrCantRegister2ManyKeyFds,fd);
return 0;
}
+ if (fd < 0) {
+ mp_msg(MSGT_INPUT, MSGL_ERR, "Invalid fd %i in mp_input_add_key_fd", fd);
+ return 0;
+ }
memset(&key_fds[num_key_fd],0,sizeof(mp_input_fd_t));
key_fds[num_key_fd].fd = fd;
@@ -673,6 +681,10 @@ mp_input_add_event_fd(int fd, void (*read_func)(void))
mp_msg(MSGT_INPUT,MSGL_ERR,MSGTR_INPUT_INPUT_ErrCantRegister2ManyKeyFds,fd);
return 0;
}
+ if (fd < 0) {
+ mp_msg(MSGT_INPUT, MSGL_ERR, "Invalid fd %i in mp_input_add_event_fd", fd);
+ return 0;
+ }
memset(&key_fds[num_key_fd],0,sizeof(mp_input_fd_t));
key_fds[num_key_fd].fd = fd;