diff --git a/sysvinit-2.86-fuse-no-kill.patch b/sysvinit-2.86-fuse-no-kill.patch new file mode 100644 index 0000000..2be70e9 --- /dev/null +++ b/sysvinit-2.86-fuse-no-kill.patch @@ -0,0 +1,117 @@ +--- src/killall5.c ++++ src/killall5.c +@@ -274,6 +274,7 @@ + + /* + * Read the proc filesystem. ++ * CWD must be /proc. + */ + int readproc() + { +@@ -289,7 +290,7 @@ + int pid, f; + + /* Open the /proc directory. */ +- if ((dir = opendir("/proc")) == NULL) { ++ if ((dir = opendir(".")) == NULL) { + nsyslog(LOG_ERR, "cannot opendir(/proc)"); + return -1; + } +@@ -316,10 +317,10 @@ + memset(p, 0, sizeof(PROC)); + + /* Open the status file. */ +- snprintf(path, sizeof(path), "/proc/%s/stat", d->d_name); ++ snprintf(path, sizeof(path), "%s/stat", d->d_name); + + /* Read SID & statname from it. */ +- if ((fp = fopen(path, "r")) != NULL) { ++ if ((fp = fopen(path, "r")) != NULL) { + buf[0] = 0; + fgets(buf, sizeof(buf), fp); + +@@ -333,7 +334,7 @@ + if (q == NULL) { + p->sid = 0; + nsyslog(LOG_ERR, +- "can't get program name from %s\n", ++ "can't get program name from /proc/%s\n", + path); + if (p->argv0) free(p->argv0); + if (p->argv1) free(p->argv1); +@@ -379,7 +380,7 @@ + continue; + } + +- snprintf(path, sizeof(path), "/proc/%s/cmdline", d->d_name); ++ snprintf(path, sizeof(path), "%s/cmdline", d->d_name); + if ((fp = fopen(path, "r")) != NULL) { + + /* Now read argv[0] */ +@@ -446,6 +447,39 @@ + return 0; + } + ++/* ++ * Scan the filedescriptors of pid for /dev/fuse ++ * CWD must be /proc. ++ */ ++int is_fuse(int pid) { ++ DIR *dir; ++ char path[256]; ++ char buf[256]; ++ struct dirent *d; ++ ssize_t len; ++ ++ /* Open /proc/pid/fd/ */ ++ snprintf(path, sizeof(path), "%d/fd", pid); ++ if ((dir = opendir(path)) != NULL) { ++ /* Walk through the directory. */ ++ while ((d = readdir(dir)) != NULL) { ++ /* check for /dev/fuse */ ++ snprintf(path, sizeof(path), "%d/fd/%s", ++ pid, d->d_name); ++ if ((len = readlink(path, buf, sizeof(buf))) > 0) { ++ if (strncmp("/dev/fuse", buf, len) == 0) { ++ /* Fuse filesystem */ ++ return 1; ++ } ++ } ++ } ++ closedir(dir); ++ } ++ ++ /* Not a fuse filesystem */ ++ return 0; ++} ++ + PIDQ_HEAD *init_pid_q(PIDQ_HEAD *q) + { + q->head = q->next = q->tail = NULL; +@@ -749,6 +783,11 @@ + /* Which NFS partitions are online? */ + init_nfs(); + ++ if (chdir("/proc") == -1) { ++ nsyslog(LOG_ERR, "chdir /proc failed"); ++ return(1); ++ } ++ + /* + * Ignoring SIGKILL and SIGSTOP do not make sense, but + * someday kill(-1, sig) might kill ourself if we don't +@@ -769,11 +808,12 @@ + exit(1); + } + +- /* Now kill all processes except our session. */ ++ /* Now kill all processes except init (pid 1), our session, ++ and FUSE filesystems. */ + sid = (int)getsid(0); + pid = (int)getpid(); + for (p = plist; p; p = p->next) { +- if (p->pid == 1 || p->pid == pid || p->sid == sid || p->kernel) { ++ if (p->pid == 1 || p->pid == pid || p->sid == sid || p->kernel || is_fuse(p->pid)) { + kill(p->pid, SIGCONT); + continue; + } diff --git a/sysvinit.changes b/sysvinit.changes index 5b3272b..edd21f9 100644 --- a/sysvinit.changes +++ b/sysvinit.changes @@ -1,3 +1,8 @@ +------------------------------------------------------------------- +Wed Sep 17 14:06:04 CEST 2008 - uli@suse.de + +- killall5: don't kill FUSE filesystems (Debian bug #476698) + ------------------------------------------------------------------- Mon Sep 15 12:23:36 CEST 2008 - ro@suse.de diff --git a/sysvinit.spec b/sysvinit.spec index 56179dd..3f47bdc 100644 --- a/sysvinit.spec +++ b/sysvinit.spec @@ -30,7 +30,7 @@ Group: System/Base PreReq: coreutils AutoReqProv: on Version: 2.86 -Release: 182 +Release: 183 Summary: SysV-Style init BuildRoot: %{_tmppath}/%{name}-%{version}-build BuildRequires: libselinux-devel libsepol-devel @@ -62,6 +62,7 @@ Patch15: sysvinit-2.86-usage-message.patch Patch16: sysvinit-2.86-full-time.patch Patch17: sysvinit-2.86-hddown.patch Patch18: sysvinit-2.86-selinux.patch +Patch19: sysvinit-2.86-fuse-no-kill.patch %description System V style init programs by Miquel van Smoorenburg that control the @@ -96,6 +97,7 @@ Authors: %patch -P 16 -b .fulltime %patch -P 17 -b .hddown %patch -P 18 -b .selinux +%patch -P 19 -b .fuse %patch pushd ../powerd-%{PDVER} %patch -P 2 @@ -315,6 +317,8 @@ rm -rf ${RPM_BUILD_ROOT} %doc %{_mandir}/man8/startpar.8.gz %changelog +* Wed Sep 17 2008 uli@suse.de +- killall5: don't kill FUSE filesystems (Debian bug #476698) * Mon Sep 15 2008 ro@suse.de - add detection for OBS build environment * Wed Sep 03 2008 hare@suse.de