From 15c51e3d6e9c7b31a82e74988b3929ff0eb0f27a Mon Sep 17 00:00:00 2001 From: P. J. McDermott Date: Mon, 18 Jan 2016 12:07:41 -0500 Subject: Add explicit returns to some functions --- (limited to 'src') diff --git a/src/block.sh b/src/block.sh index ad94bde..f3fb8da 100644 --- a/src/block.sh +++ b/src/block.sh @@ -34,6 +34,8 @@ check_block() error "$(get_msg 'block_device_invalid')" "${dev}" return 1 fi + + return 0 } block_mount() diff --git a/src/cmd.sh b/src/cmd.sh index 9afad7c..a42744d 100644 --- a/src/cmd.sh +++ b/src/cmd.sh @@ -100,6 +100,8 @@ is_cmd() local cmd="${1}" [ "x$(printf '%s\n' ${cmds} | grep "^${cmd}$")" = "x${cmd}" ] + + return ${?} } run_cmd() @@ -120,4 +122,6 @@ run_cmd() error "$(get_msg 'cmd_not_found')" "${cmd}" return 1 fi + + return 0 } diff --git a/src/mutex.sh b/src/mutex.sh index cd4a365..ab9824c 100644 --- a/src/mutex.sh +++ b/src/mutex.sh @@ -23,6 +23,8 @@ mutex_trylock() local mutex="${1}" (set -C; printf '%d\n' "${$}" >"${mutex}") 2>/dev/null + + return ${?} } mutex_timedlock() @@ -51,4 +53,6 @@ mutex_is_unlockable() local mutex="${1}" [ "x$(cat "${mutex}" 2>/dev/null)" = "x${$}" ] + + return ${?} } diff --git a/src/opkg.sh b/src/opkg.sh index 9e5c3c4..2f10244 100644 --- a/src/opkg.sh +++ b/src/opkg.sh @@ -21,9 +21,13 @@ opkg_install_all() { local root="${1}" + local es= session_begin "${root}" . : true session_exec /bin/sh -c \ 'opkg install $(opkg list-installed | cut -d " " -f 1)' + es=${?} session_end + + return ${es} } diff --git a/src/session.sh b/src/session.sh index 5390cf3..2ddf6ff 100644 --- a/src/session.sh +++ b/src/session.sh @@ -80,6 +80,8 @@ session_begin() "${session_root}/prokit/sessions/${session_id}/wd" mutex_unlock "${session_root}/prokit/sessions.lock" + + return 0 } session_end() @@ -113,6 +115,8 @@ session_end() mutex_unlock "${session_root}/prokit/sessions.lock" trap - ${session_sigs} + + return 0 } session_id() @@ -139,6 +143,8 @@ session_exec() done session_dir="/prokit/sessions/${session_id}/wd" chroot "${session_root}" /bin/sh -c "cd ${session_dir}; ${args}" + + return ${?} } session_mount() -- cgit v0.9.1