Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc-2-2
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-2-2
Commits
29d3ded7
Commit
29d3ded7
authored
Nov 05, 2011
by
Rémi Denis-Courmont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
cddb: do not use alarm()
It does not work on Windows, and is not thread-safe on Linux.
parent
1193208c
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
51 additions
and
0 deletions
+51
-0
contrib/src/cddb/cddb-no-alarm.patch
contrib/src/cddb/cddb-no-alarm.patch
+50
-0
contrib/src/cddb/rules.mak
contrib/src/cddb/rules.mak
+1
-0
No files found.
contrib/src/cddb/cddb-no-alarm.patch
0 → 100644
View file @
29d3ded7
diff -ru cddb.orig/lib/cddb_net.c cddb/lib/cddb_net.c
--- cddb.orig/lib/cddb_net.c 2011-11-05 18:21:42.000000000 +0200
+++ cddb/lib/cddb_net.c 2011-11-05 18:22:11.000000000 +0200
@@ -228,46 +228,9 @@
/* Time-out enabled work-alikes */
-#ifdef HAVE_ALARM
-/* time-out jump buffer */
-static jmp_buf timeout_expired;
-
-/* time-out signal handler */
-static void alarm_handler(int signum)
-{
- longjmp(timeout_expired, 1);
-}
-#endif
-
struct hostent *timeout_gethostbyname(const char *hostname, int timeout)
{
-#ifdef HAVE_ALARM
- struct hostent *he = NULL;
- struct sigaction action;
- struct sigaction old;
-
- /* no signal before setjmp */
- alarm(0);
-
- /* register signal handler */
- memset(&action, 0, sizeof(action));
- action.sa_handler = alarm_handler;
- sigaction(SIGALRM, &action, &old);
-
- /* save stack state */
- if (!setjmp(timeout_expired)) {
- alarm(timeout); /* set time-out alarm */
- he = gethostbyname(hostname); /* execute DNS query */
- alarm(0); /* reset alarm timer */
- } else {
- errno = ETIMEDOUT;
- }
- sigaction(SIGALRM, &old, NULL); /* restore previous signal handler */
-
- return he;
-#else
return gethostbyname(hostname); /* execute DNS query directly */
-#endif
}
int timeout_connect(int sockfd, const struct sockaddr *addr,
contrib/src/cddb/rules.mak
View file @
29d3ded7
...
...
@@ -18,6 +18,7 @@ cddb: libcddb-$(CDDB_VERSION).tar.bz2 .sum-cddb
$(UNPACK)
$(APPLY)
$(SRC)
/cddb/cross.patch
$(APPLY)
$(SRC)
/cddb/getenv-crash.patch
$(APPLY)
$(SRC)
/cddb/cddb-no-alarm.patch
ifdef
HAVE_WIN32
$(APPLY)
$(SRC)
/cddb/win32-pkg.patch
endif
...
...
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