summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorP. J. McDermott <pj@pehjota.net>2016-01-17 15:58:08 (EST)
committer P. J. McDermott <pj@pehjota.net>2016-01-17 15:58:08 (EST)
commitb18172598f83bbdc0dc8dd99ed7f587972fc8b32 (patch)
tree25e4f2e10a9b6fc6416231b89d21c81e86e4e407
parent6736b550f112f14c17401329a6a2a63ddc53e68b (diff)
session_begin(), session_end(): Use non-exiting error()
-rw-r--r--src/session.sh11
1 files changed, 8 insertions, 3 deletions
diff --git a/src/session.sh b/src/session.sh
index 6453fae..0728080 100644
--- a/src/session.sh
+++ b/src/session.sh
@@ -43,13 +43,16 @@ session_begin()
[ -d "${session_root}/prokit" ] || mkdir "${session_root}/prokit"
if [ -f "${session_root}/prokit/installing" ] && ! ${installing}; then
- error 2 "$(get_msg 'install_running')"
+ error "$(get_msg 'install_running')"
+ return 1
fi
session_set_sigs
if ! mutex_timedlock "${session_root}/prokit/sessions.lock" 5; then
- error 2 "$(get_msg 'cant_lock_sessions')"
+ error "$(get_msg 'cant_lock_sessions')"
+ trap - ${session_sigs}
+ return 1
fi
# Check for a sessions pool.
@@ -95,7 +98,9 @@ session_end()
if ! mutex_is_unlockable "${session_root}/prokit/sessions.lock"; then
if ! mutex_timedlock "${session_root}/prokit/sessions.lock" 5
then
- error 2 "$(get_msg 'cant_lock_sessions')"
+ error "$(get_msg 'cant_lock_sessions')"
+ trap - ${session_sigs}
+ return 1
fi
fi