summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorPatrick McDermott <patrick.mcdermott@libiquity.com>2018-12-24 14:19:47 (EST)
committer Patrick McDermott <patrick.mcdermott@libiquity.com>2018-12-24 14:19:47 (EST)
commit0f5caf14a3124c24f38f340fd6504532f07d9617 (patch)
tree581bd96687258321bc62e506f5dec5773f3350a2 /lib
parent0b5016dc60e6ff1eff591d5de5b045463df8093e (diff)
ob_parse_dep(), ob_reduce_deps(): Initialize OPTIND before getopts
Dash and BusyBox ash apparently do this themselves, but GNU Bash (and other shells?) don't. POSIX says that getopts can be used more than once if OPTIND is set to 1, but using getopts multiple times with different parameters without setting OPTIND to 1 "produces unspecified results".
Diffstat (limited to 'lib')
-rw-r--r--lib/deps.sh2
1 files changed, 2 insertions, 0 deletions
diff --git a/lib/deps.sh b/lib/deps.sh
index 167c41b..760a529 100644
--- a/lib/deps.sh
+++ b/lib/deps.sh
@@ -39,6 +39,7 @@ ob_parse_dep()
local comp=
local comp_var=
+ OPTIND=1
while getopts 'p:q:r:v:A:l:a:P:' opt; do
case "${opt}" in
p)
@@ -163,6 +164,7 @@ ob_reduce_deps()
union='false'
+ OPTIND=1
while getopts 'a:P:u' opt; do
case "${opt}" in
a)