inotify: Block signals in the inotify thread.
Otherwise, we may get invalid reads due to double-handling of signals.
This commit is contained in:
parent
d097d3c02d
commit
c985eee9c7
@ -641,7 +641,7 @@ inotify_remove_directory(int fd, const char * path)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void *
|
void *
|
||||||
start_inotify()
|
start_inotify(void)
|
||||||
{
|
{
|
||||||
struct pollfd pollfds[1];
|
struct pollfd pollfds[1];
|
||||||
int timeout = 1000;
|
int timeout = 1000;
|
||||||
@ -650,6 +650,10 @@ start_inotify()
|
|||||||
int length, i = 0;
|
int length, i = 0;
|
||||||
char * esc_name = NULL;
|
char * esc_name = NULL;
|
||||||
struct stat st;
|
struct stat st;
|
||||||
|
sigset_t set;
|
||||||
|
|
||||||
|
sigfillset(&set);
|
||||||
|
pthread_sigmask(SIG_BLOCK, &set, NULL);
|
||||||
|
|
||||||
pollfds[0].fd = inotify_init();
|
pollfds[0].fd = inotify_init();
|
||||||
pollfds[0].events = POLLIN;
|
pollfds[0].events = POLLIN;
|
||||||
|
@ -1299,10 +1299,6 @@ shutdown:
|
|||||||
if (scanning && scanner_pid)
|
if (scanning && scanner_pid)
|
||||||
kill(scanner_pid, SIGKILL);
|
kill(scanner_pid, SIGKILL);
|
||||||
|
|
||||||
/* kill other child processes */
|
|
||||||
process_reap_children();
|
|
||||||
free(children);
|
|
||||||
|
|
||||||
/* close out open sockets */
|
/* close out open sockets */
|
||||||
while (upnphttphead.lh_first != NULL)
|
while (upnphttphead.lh_first != NULL)
|
||||||
{
|
{
|
||||||
@ -1330,6 +1326,10 @@ shutdown:
|
|||||||
if (inotify_thread)
|
if (inotify_thread)
|
||||||
pthread_join(inotify_thread, NULL);
|
pthread_join(inotify_thread, NULL);
|
||||||
|
|
||||||
|
/* kill other child processes */
|
||||||
|
process_reap_children();
|
||||||
|
free(children);
|
||||||
|
|
||||||
sql_exec(db, "UPDATE SETTINGS set VALUE = '%u' where KEY = 'UPDATE_ID'", updateID);
|
sql_exec(db, "UPDATE SETTINGS set VALUE = '%u' where KEY = 'UPDATE_ID'", updateID);
|
||||||
sqlite3_close(db);
|
sqlite3_close(db);
|
||||||
|
|
||||||
|
@ -96,10 +96,10 @@ process_fork(struct client_cache_s *client)
|
|||||||
pid_t pid = fork();
|
pid_t pid = fork();
|
||||||
if (pid > 0)
|
if (pid > 0)
|
||||||
{
|
{
|
||||||
number_of_children++;
|
|
||||||
if (client)
|
if (client)
|
||||||
client->connections++;
|
client->connections++;
|
||||||
add_process_info(pid, client);
|
add_process_info(pid, client);
|
||||||
|
number_of_children++;
|
||||||
}
|
}
|
||||||
|
|
||||||
return pid;
|
return pid;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user