aboutsummaryrefslogtreecommitdiffstats
path: root/src/libstrongswan/plugins/attr_sql/pool.c
diff options
context:
space:
mode:
authorHeiko Hund <hhund@astaro.com>2010-03-23 22:30:01 +0100
committerMartin Willi <martin@revosec.ch>2010-03-24 08:21:36 +0100
commit0d59713dd98d2eab632376dd258e99cb257921cc (patch)
treef5c8815048121e679ce4d77f2faac611efbea91a /src/libstrongswan/plugins/attr_sql/pool.c
parentcf46ff687584f0dd507336fef72888593a85cb3c (diff)
downloadstrongswan-0d59713dd98d2eab632376dd258e99cb257921cc.tar.bz2
strongswan-0d59713dd98d2eab632376dd258e99cb257921cc.tar.xz
Fixed ipsec pool --batch command
--batch mode has shown to be buggy in very obscure ways in the first real life tests. For example a batch file --del pool1 --replace pool2 --addresses file1 returned the error "/usr/libexec/ipsec/pool: unrecognized option '--lace'" which was gone after moving the --del behind --replace. With the patch from below applied everything works like a charm. From the info on the man page it seem to be unrelated to this problem, though: A program that scans multiple argument vectors, or rescans the same vector more than once, and wants to make use of GNU extensions such as '+' and '-' at the start of optstring, or changes the value of POSIXLY_CORRECT between scans, must reinitialize getopt() by resetting optind to 0, rather than the traditional value of 1. (Resetting to 0 forces the invocation of an internal initialization routine that rechecks POSIXLY_CORRECT and checks for GNU exten- sions in optstring.) Signed-off-by: Heiko Hund <hhund@astaro.com>
Diffstat (limited to 'src/libstrongswan/plugins/attr_sql/pool.c')
-rw-r--r--src/libstrongswan/plugins/attr_sql/pool.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/libstrongswan/plugins/attr_sql/pool.c b/src/libstrongswan/plugins/attr_sql/pool.c
index 77d189707..5ecf80b42 100644
--- a/src/libstrongswan/plugins/attr_sql/pool.c
+++ b/src/libstrongswan/plugins/attr_sql/pool.c
@@ -1156,8 +1156,8 @@ static void do_args(int argc, char *argv[])
OP_BATCH
} operation = OP_UNDEF;
- /* set option index to first argument */
- optind = 1;
+ /* reinit getopt state */
+ optind = 0;
while (TRUE)
{