Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
epggrab: try to fix the thread kill & wrong memory access
  • Loading branch information
perexg committed Dec 1, 2014
1 parent 70b3ef6 commit 3e505d7
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/epggrab/module.c
Expand Up @@ -248,6 +248,7 @@ epggrab_module_int_done( void *m )
{
epggrab_module_int_t *mod = m;
free((char *)mod->path);
mod->path = NULL;
}

epggrab_module_int_t *epggrab_module_int_create
Expand Down Expand Up @@ -416,7 +417,7 @@ epggrab_module_done_socket( void *m )
shutdown(sock, SHUT_RDWR);
close(sock);
if (mod->tid) {
pthread_kill(mod->tid, SIGTERM);
pthread_kill(mod->tid, SIGQUIT);
pthread_join(mod->tid, NULL);
}
mod->tid = 0;
Expand Down
5 changes: 5 additions & 0 deletions src/wrappers.c
Expand Up @@ -104,6 +104,9 @@ tvh_fopen(const char *filename, const char *mode)
return f;
}

static void doquit(int sig)
{
}

struct
thread_state {
Expand All @@ -130,9 +133,11 @@ thread_wrapper ( void *p )

sigemptyset(&set);
sigaddset(&set, SIGTERM);
sigaddset(&set, SIGQUIT);
pthread_sigmask(SIG_UNBLOCK, &set, NULL);

signal(SIGTERM, doexit);
signal(SIGQUIT, doquit);

/* Run */
tvhtrace("thread", "created thread %ld [%s / %p(%p)]",
Expand Down

0 comments on commit 3e505d7

Please sign in to comment.