summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPatrick McDermott <patrick.mcdermott@libiquity.com>2019-04-13 22:23:07 (EDT)
committer Patrick McDermott <patrick.mcdermott@libiquity.com>2019-04-13 22:23:07 (EDT)
commit48b40a53b0746848d5c8ea881d319e6120c76d40 (patch)
treebc5a0ea2d54fa16bd16e5eb94bb17f9284cf1f69
parentef4eb0755371c88b197bcd8ac99355063e2d39f6 (diff)
src/main.sh: Move _lock() and _unlock()
And fix an _unlock() call.
-rw-r--r--src/main.sh30
1 files changed, 15 insertions, 15 deletions
diff --git a/src/main.sh b/src/main.sh
index e56c076..3a67c84 100644
--- a/src/main.sh
+++ b/src/main.sh
@@ -41,12 +41,26 @@ conf_key=
lock=
exit_status=
+_lock()
+{
+ mkdir -p "${base_dir}/.db"
+ lock="${base_dir}/.db/lock"
+ if ! (set -C; printf '%d\n' "${$}" >"${lock}") 2>/dev/null; then
+ error 2 "$(get_msg 'lock_fail')"
+ fi
+}
+
+_unlock()
+{
+ rm -f "${lock}"
+}
+
_handle_sig()
{
local sig="${1}"
shift 1
- unlock
+ _unlock
if [ "x${exit_status:+set}" = 'xset' ]; then
exit ${exit_status}
@@ -90,15 +104,6 @@ _get_options()
return 0
}
-_lock()
-{
- mkdir -p "${base_dir}/.db"
- lock="${base_dir}/.db/lock"
- if ! (set -C; printf '%d\n' "${$}" >"${lock}") 2>/dev/null; then
- error 2 "$(get_msg 'lock_fail')"
- fi
-}
-
_get_conf()
{
local old_dir=
@@ -134,11 +139,6 @@ init()
_get_conf
}
-_unlock()
-{
- rm -f "${lock}"
-}
-
fini()
{
update_feeds