summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorP. J. McDermott <pjm@nac.net>2012-10-09 22:18:12 (EDT)
committer P. J. McDermott <pjm@nac.net>2012-10-09 22:18:12 (EDT)
commit1df56265ec58a98b85f63d4c0f2ff09cb4f346e0 (patch)
treef4a6388e839dcbaefa31e3c734dfd077daa57f81
parent2b3e3b11f5f8d7e396a5653c61089121a47bc4a9 (diff)
Protect library functions from IFS changes.
-rw-r--r--lib/common.sh9
1 files changed, 9 insertions, 0 deletions
diff --git a/lib/common.sh b/lib/common.sh
index 1488bd7..78f1c62 100644
--- a/lib/common.sh
+++ b/lib/common.sh
@@ -21,21 +21,30 @@
_OB_COMMON_SM='true'
_OB_STACK_VARS=
+_OB_SAVED_IFS=
_ob_local()
{
# Push the variable list onto the stack.
_OB_STACK_VARS="${_OB_STACK_VARS}|${*}"
+
+ # Save the old IFS value, if any, and set it to its default.
+ _OB_SAVED_IFS="${IFS}"
+ unset IFS
}
_ob_return()
{
# Unset the variables at the top of the stack.
+ IFS=' '
unset -v ${_OB_STACK_VARS##*|}
# Pop the variable list from the top of the stack.
_OB_STACK_VARS="${_OB_STACK_VARS%|*}"
+ # Restore the saved IFS.
+ IFS="${_OB_SAVED_IFS}"
+
return ${1}
}