summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMiklos Szeredi <miklos@szeredi.hu>2007-05-24 18:51:08 +0000
committerMiklos Szeredi <miklos@szeredi.hu>2007-05-24 18:51:08 +0000
commita13323d10b62bafec9075126be8fc5bc02de82f2 (patch)
treef347357ea07ff415dae8e92aa6edcf31455bb3c2
parentea21aafdb9345a4996d98db127177b6845124522 (diff)
downloadfuse_2_6_bugfix.tar.gz
fix memory leak on thread creation failure...fuse_2_6_bugfix
-rw-r--r--ChangeLog9
-rw-r--r--lib/fuse_loop_mt.c2
-rw-r--r--lib/fuse_signals.c3
3 files changed, 13 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index 02e965b..0dde32d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2007-05-24 Miklos Szeredi <miklos@szeredi.hu>
+
+ * lib: fix memory leak on thread creation failure in multithreaded
+ event loop. Found by Chris AtLee
+
+ * Filesystems (e.g. sshfs) failed to exit if SIGHUP handler is
+ SIG_IGN in the parent process. So install handler for SIGHUP even
+ in this case. Reported by Tim Walberg
+
2007-05-21 Miklos Szeredi <miklos@szeredi.hu>
* Fix Oops or error if a regular file is created with mknod(2) on
diff --git a/lib/fuse_loop_mt.c b/lib/fuse_loop_mt.c
index 8f5db89..27fea31 100644
--- a/lib/fuse_loop_mt.c
+++ b/lib/fuse_loop_mt.c
@@ -143,6 +143,8 @@ static int fuse_start_thread(struct fuse_mt *mt)
pthread_sigmask(SIG_SETMASK, &oldset, NULL);
if (res != 0) {
fprintf(stderr, "fuse: error creating thread: %s\n", strerror(res));
+ free(w->buf);
+ free(w);
return -1;
}
list_add_worker(w, &mt->main);
diff --git a/lib/fuse_signals.c b/lib/fuse_signals.c
index 6154110..8291ea0 100644
--- a/lib/fuse_signals.c
+++ b/lib/fuse_signals.c
@@ -36,7 +36,8 @@ static int set_one_signal_handler(int sig, void (*handler)(int))
return -1;
}
- if (old_sa.sa_handler == SIG_DFL &&
+ if ((old_sa.sa_handler == SIG_DFL ||
+ (sig == SIGHUP && old_sa.sa_handler == SIG_IGN)) &&
sigaction(sig, &sa, NULL) == -1) {
perror("fuse: cannot set signal handler");
return -1;