Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Redmine
Redmine
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
videolan
vlc
Commits
0f9d30d5
Commit
0f9d30d5
authored
Jan 18, 2008
by
Rémi Denis-Courmont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use poll() instead of select() to fix an unlikely overflow in FD_SET
parent
61630d2b
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
12 deletions
+7
-12
modules/gui/skins2/x11/x11_timer.cpp
modules/gui/skins2/x11/x11_timer.cpp
+7
-12
No files found.
modules/gui/skins2/x11/x11_timer.cpp
View file @
0f9d30d5
...
@@ -26,6 +26,7 @@
...
@@ -26,6 +26,7 @@
#include <unistd.h>
#include <unistd.h>
#include <fcntl.h>
#include <fcntl.h>
#include <poll.h>
#include "x11_timer.hpp"
#include "x11_timer.hpp"
#include "x11_factory.hpp"
#include "x11_factory.hpp"
...
@@ -146,20 +147,14 @@ void X11TimerLoop::waitNextTimer()
...
@@ -146,20 +147,14 @@ void X11TimerLoop::waitNextTimer()
bool
X11TimerLoop
::
sleep
(
int
delay
)
bool
X11TimerLoop
::
sleep
(
int
delay
)
{
{
// Timeout delay
struct
pollfd
ufd
=
{
struct
timeval
tv
;
.
fd
=
m_connectionNumber
,
tv
.
tv_sec
=
delay
/
1000
;
.
events
=
POLLIN
,
tv
.
tv_usec
=
1000
*
(
delay
%
1000
);
};
// FD set for select()
fd_set
rfds
;
FD_ZERO
(
&
rfds
);
FD_SET
(
m_connectionNumber
,
&
rfds
);
// Wait for an X11 event, or timeout
// Wait for an X11 event, or timeout
int
num
=
select
(
m_connectionNumber
+
1
,
&
rfds
,
NULL
,
NULL
,
&
tv
);
// TODO: use VLC object waitpipe?
return
poll
(
&
ufd
,
1
,
delay
)
>
0
;
return
(
num
>
0
);
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment