summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorP. J. McDermott <pj@pehjota.net>2016-01-18 12:07:41 (EST)
committer P. J. McDermott <pj@pehjota.net>2016-01-18 12:07:41 (EST)
commit15c51e3d6e9c7b31a82e74988b3929ff0eb0f27a (patch)
tree747c851f08f854a5923a8f5646fa07afa001eb56 /src
parent7831304e08e5a6092e4df7343f8e7de69decb69c (diff)
Add explicit returns to some functions
Diffstat (limited to 'src')
-rw-r--r--src/block.sh2
-rw-r--r--src/cmd.sh4
-rw-r--r--src/mutex.sh4
-rw-r--r--src/opkg.sh4
-rw-r--r--src/session.sh6
5 files changed, 20 insertions, 0 deletions
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()