summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNarrat <autumn-wind@web.de>2017-02-03 16:39:09 (GMT)
committer Narrat <autumn-wind@web.de>2017-02-03 16:46:16 (GMT)
commit537bb6aaebb5ff27e1f6786341a991d4b56b87bf (patch)
tree7af75b2a6d2ac4bbd37fe6a869f67525f19e83e8
parent1f852908ae669cabcce0c3206baea33bb10c1ee3 (diff)
Use of lsof to fix slam for specific mountpoint
Apparantly fuser didn't report back, if the tomb was mounted in a subdir of /run (whereas /run itself is often a tmpfs mount). With no list of process ids those couldn't be killed, so slamming the tomb failed. lsof is capable to report back the sought information. Fixes #220 Additionally fixing the debug output, where a hardcoded mountpoint was used
-rw-r--r--INSTALL.md1
-rwxr-xr-xtomb8
2 files changed, 5 insertions, 4 deletions
diff --git a/INSTALL.md b/INSTALL.md
index 996ada3..56a8bc7 100644
--- a/INSTALL.md
+++ b/INSTALL.md
@@ -9,6 +9,7 @@ Tomb needs a few programs to be installed on a system in order to work:
* gnupg
* cryptsetup
* pinentry-curses (and/or -gtk-2, -x11, -qt)
+ * lsof
Most systems provide these tools in their package collection, for
instance on Debian/Ubuntu one can use `apt-get install` on Fedora and
diff --git a/tomb b/tomb
index 1a1a632..57260a7 100755
--- a/tomb
+++ b/tomb
@@ -2506,20 +2506,20 @@ umount_tomb() {
# Kill all processes using the tomb
slam_tomb() {
# $1 = tomb mount point
- if [[ -z `fuser -m "$1" 2>/dev/null` ]]; then
+ if [[ -z `lsof -t +D "$1" 2>/dev/null` ]]; then
return 0
fi
#Note: shells are NOT killed by INT or TERM, but they are killed by HUP
for s in TERM HUP KILL; do
_verbose "Sending ::1:: to processes inside the tomb:" $s
if option_is_set -D; then
- ps -fp `fuser -m /media/a.tomb 2>/dev/null`|
+ ps -fp `lsof -t +D "$1" 2>/dev/null`|
while read line; do
_verbose $line
done
fi
- fuser -s -m "$1" -k -M -$s
- if [[ -z `fuser -m "$1" 2>/dev/null` ]]; then
+ kill -$s `lsof -t +D "$1"`
+ if [[ -z `lsof -t +D "$1" 2>/dev/null` ]]; then
return 0
fi
if ! option_is_set -f; then