summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorP. J. McDermott <pj@pehjota.net>2014-10-07 16:58:50 (EDT)
committer P. J. McDermott <pj@pehjota.net>2014-10-07 16:58:50 (EDT)
commit6a4c4b1696e6f81c1d53f5e8a51bb2589a608bfc (patch)
treea410715568763555733b8ff0a7d381443497b40d
parent5393e50727c29bd29c4461019e2b426f701a88c5 (diff)
session_end(): Block signals for func's lifetime
If prokit receives a signal (e.g. the user hits Ctrl+C) while session_end() is running (e.g. while unmounting file systems), the system can be left in an unclean state (e.g. with some file systems still mounted and the sessions change mutex permanently locked).
-rw-r--r--lib/session.sh9
1 files changed, 3 insertions, 6 deletions
diff --git a/lib/session.sh b/lib/session.sh
index 834567c..05fecc4 100644
--- a/lib/session.sh
+++ b/lib/session.sh
@@ -90,7 +90,7 @@ session_begin()
session_end()
{
- session_unset_sigs
+ trap : ${session_sigs}
${session_atexit}
@@ -115,6 +115,8 @@ session_end()
fi
mutex_unlock "${session_root}/prokit/sessions.lock"
+
+ trap - ${session_sigs}
}
session_id()
@@ -203,11 +205,6 @@ session_set_sigs()
done
}
-session_unset_sigs()
-{
- trap - ${session_sigs}
-}
-
session_handle_sig()
{
local sig="${1}"