summaryrefslogtreecommitdiff
path: root/sh/functions.sh.in
diff options
context:
space:
mode:
authorRoy Marples <roy@marples.name>2008-04-18 23:00:43 +0000
committerRoy Marples <roy@marples.name>2008-04-18 23:00:43 +0000
commite96347523f7bfa7da55c34c34af6dcdedd939ba9 (patch)
tree181b118e8ad7640d6c6ffe33263d401657b8b3d1 /sh/functions.sh.in
parentf0aacec02eb04f1843cc5c729fd5510c2342660c (diff)
downloadopenrc-e96347523f7bfa7da55c34c34af6dcdedd939ba9.tar.gz
openrc-e96347523f7bfa7da55c34c34af6dcdedd939ba9.tar.bz2
openrc-e96347523f7bfa7da55c34c34af6dcdedd939ba9.tar.xz
We should check type output to ensure that we're really calling a shell function and not some badly named binary like stop from boinc, Gentoo #218063.
Diffstat (limited to 'sh/functions.sh.in')
-rw-r--r--sh/functions.sh.in9
1 files changed, 9 insertions, 0 deletions
diff --git a/sh/functions.sh.in b/sh/functions.sh.in
index 57917ed..8b7356a 100644
--- a/sh/functions.sh.in
+++ b/sh/functions.sh.in
@@ -20,6 +20,15 @@ eoutdent()
return 0
}
+is_function()
+{
+ if [ -n "${BASH_VERSION}" ]; then
+ [ "$(type -t "$1")" = "function" ]
+ else
+ [ "$(type "$1" 2>/dev/null)" = "$1 is a shell function" ]
+ fi
+}
+
yesno()
{
[ -z "$1" ] && return 1