diff options
author | dteske <dteske@FreeBSD.org> | 2014-09-01 22:53:47 +0000 |
---|---|---|
committer | dteske <dteske@FreeBSD.org> | 2014-09-01 22:53:47 +0000 |
commit | 383919db1a56bd93721e2ff45096958b36de660d (patch) | |
tree | 2cc8e671128d6cc590d2f41b5dbe48b1e84f0bac /usr.sbin | |
parent | c1f3eb16af7730f8b65686792a66831af9b7debd (diff) | |
download | FreeBSD-src-383919db1a56bd93721e2ff45096958b36de660d.zip FreeBSD-src-383919db1a56bd93721e2ff45096958b36de660d.tar.gz |
Fix a bug where command line arguments could be misprocessed if getopts is
used prior to f_dialog_init() -- e.g., in a script that sets
DIALOG_SELF_INITIALIZE to NULL, preventing f_dialog_init() from being run
automaticaly when `dialog.subr' is included. Caused by sub-shell processing
of arguments inheriting prior value of $OPTIND, used by getopts. Solved by
unsetting OPTIND prior to [re-]processing of positional arguments.
Diffstat (limited to 'usr.sbin')
-rw-r--r-- | usr.sbin/bsdconfig/share/dialog.subr | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/usr.sbin/bsdconfig/share/dialog.subr b/usr.sbin/bsdconfig/share/dialog.subr index 49e72ee..780bfcd 100644 --- a/usr.sbin/bsdconfig/share/dialog.subr +++ b/usr.sbin/bsdconfig/share/dialog.subr @@ -2116,6 +2116,7 @@ f_dialog_init() f_dprintf "f_dialog_init: ARGV=[%s] GETOPTS_STDARGS=[%s]" \ "$ARGV" "$GETOPTS_STDARGS" SECURE=`set -- $ARGV + unset OPTIND while getopts \ "$GETOPTS_STDARGS$GETOPTS_EXTRA$GETOPTS_ALLFLAGS" \ flag > /dev/null; do @@ -2125,6 +2126,7 @@ f_dialog_init() done ` # END-BACKTICK USE_XDIALOG=`set -- $ARGV + unset OPTIND while getopts \ "$GETOPTS_STDARGS$GETOPTS_EXTRA$GETOPTS_ALLFLAGS" \ flag > /dev/null; do |