diff options
-rw-r--r-- | src/main.sh | 30 |
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 |