From 6a4c4b1696e6f81c1d53f5e8a51bb2589a608bfc Mon Sep 17 00:00:00 2001 From: P. J. McDermott Date: Tue, 07 Oct 2014 16:58:50 -0400 Subject: 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). --- 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}" -- cgit v0.9.1