*** empty log message ***
authorMiklos Szeredi <miklos@szeredi.hu>
Sun, 27 Nov 2005 19:22:42 +0000 (19:22 +0000)
committerMiklos Szeredi <miklos@szeredi.hu>
Sun, 27 Nov 2005 19:22:42 +0000 (19:22 +0000)
ChangeLog
lib/fuse_loop_mt.c

index c15381830c661cf5df295500adbd3e86557b0740..988a9e176f0abef8c22d0b526c20c86976184a22 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2005-11-27  Miklos Szeredi <miklos@szeredi.hu>
+
+       * Block TERM, INT, HUP and QUIT signals in all but the main
+       thread.  According to POSIX it's not specified which thread will
+       receive these signals.
 2005-11-22  Miklos Szeredi <miklos@szeredi.hu>
 
        * Add detection of mainline FUSE code in running kernel
index 95399d7e5bdebed3815bed4ba093d45756788d63..05322301ca00d017cda56f468a20608ac7c9cea5 100644 (file)
@@ -116,7 +116,19 @@ static void *do_work(void *data)
 
 static int start_thread(struct fuse_worker *w, pthread_t *thread_id)
 {
-    int res = pthread_create(thread_id, NULL, do_work, w);
+    sigset_t oldset;
+    sigset_t newset;
+    int res;
+
+    /* Disallow signal reception in worker threads */
+    sigemptyset(&newset);
+    sigaddset(&newset, SIGTERM);
+    sigaddset(&newset, SIGINT);
+    sigaddset(&newset, SIGHUP);
+    sigaddset(&newset, SIGQUIT);
+    pthread_sigmask(SIG_BLOCK, &newset, &oldset);
+    res = pthread_create(thread_id, NULL, do_work, w);
+    pthread_sigmask(SIG_SETMASK, &oldset, NULL);
     if (res != 0) {
         fprintf(stderr, "fuse: error creating thread: %s\n", strerror(res));
         return -1;