[Pkg-privacy-commits] [onioncat] 216/340: parse options twice caused some troubles at least on Linux.
Ximin Luo
infinity0 at moszumanska.debian.org
Sat Aug 22 13:04:41 UTC 2015
This is an automated email from the git hooks/post-receive script.
infinity0 pushed a commit to branch debian
in repository onioncat.
commit 19970ab0a0bffec1ea9a61e3778557a7ac7ca766
Author: eagle <eagle at 58e1ccc2-750e-0410-8d0d-f93ca75ab447>
Date: Thu Feb 11 13:42:19 2010 +0000
parse options twice caused some troubles at least on Linux.
git-svn-id: http://www.cypherpunk.at/svn/onioncat/trunk@545 58e1ccc2-750e-0410-8d0d-f93ca75ab447
---
configure | 22 +++++++++++-----------
src/ocat.c | 22 ++++++++++++++++++++--
2 files changed, 31 insertions(+), 13 deletions(-)
diff --git a/configure b/configure
index 7a1e136..a00ed84 100755
--- a/configure
+++ b/configure
@@ -1,6 +1,6 @@
#! /bin/sh
# Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.62 for onioncat 0.2.2.r544.
+# Generated by GNU Autoconf 2.62 for onioncat 0.2.2.r545.
#
# Report bugs to <rahra at cypherpunk.at>.
#
@@ -596,8 +596,8 @@ SHELL=${CONFIG_SHELL-/bin/sh}
# Identity of this package.
PACKAGE_NAME='onioncat'
PACKAGE_TARNAME='onioncat'
-PACKAGE_VERSION='0.2.2.r544'
-PACKAGE_STRING='onioncat 0.2.2.r544'
+PACKAGE_VERSION='0.2.2.r545'
+PACKAGE_STRING='onioncat 0.2.2.r545'
PACKAGE_BUGREPORT='rahra at cypherpunk.at'
ac_subst_vars='SHELL
@@ -1260,7 +1260,7 @@ if test "$ac_init_help" = "long"; then
# Omit some internal or obsolete options to make the list less imposing.
# This message is too long to be a string in the A/UX 3.1 sh.
cat <<_ACEOF
-\`configure' configures onioncat 0.2.2.r544 to adapt to many kinds of systems.
+\`configure' configures onioncat 0.2.2.r545 to adapt to many kinds of systems.
Usage: $0 [OPTION]... [VAR=VALUE]...
@@ -1330,7 +1330,7 @@ fi
if test -n "$ac_init_help"; then
case $ac_init_help in
- short | recursive ) echo "Configuration of onioncat 0.2.2.r544:";;
+ short | recursive ) echo "Configuration of onioncat 0.2.2.r545:";;
esac
cat <<\_ACEOF
@@ -1422,7 +1422,7 @@ fi
test -n "$ac_init_help" && exit $ac_status
if $ac_init_version; then
cat <<\_ACEOF
-onioncat configure 0.2.2.r544
+onioncat configure 0.2.2.r545
generated by GNU Autoconf 2.62
Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001,
@@ -1436,7 +1436,7 @@ cat >config.log <<_ACEOF
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.
-It was created by onioncat $as_me 0.2.2.r544, which was
+It was created by onioncat $as_me 0.2.2.r545, which was
generated by GNU Autoconf 2.62. Invocation command line was
$ $0 $@
@@ -2085,7 +2085,7 @@ fi
# Define the identity of the package.
PACKAGE='onioncat'
- VERSION='0.2.2.r544'
+ VERSION='0.2.2.r545'
cat >>confdefs.h <<_ACEOF
@@ -2236,7 +2236,7 @@ ac_config_headers="$ac_config_headers config.h"
cat >>confdefs.h <<\_ACEOF
-#define SVN_REVISION "544"
+#define SVN_REVISION "545"
_ACEOF
@@ -5325,7 +5325,7 @@ exec 6>&1
# report actual input values of CONFIG_FILES etc. instead of their
# values after options handling.
ac_log="
-This file was extended by onioncat $as_me 0.2.2.r544, which was
+This file was extended by onioncat $as_me 0.2.2.r545, which was
generated by GNU Autoconf 2.62. Invocation command line was
CONFIG_FILES = $CONFIG_FILES
@@ -5378,7 +5378,7 @@ Report bugs to <bug-autoconf at gnu.org>."
_ACEOF
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
ac_cs_version="\\
-onioncat config.status 0.2.2.r544
+onioncat config.status 0.2.2.r545
configured by $0, generated by GNU Autoconf 2.62,
with options \\"`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`\\"
diff --git a/src/ocat.c b/src/ocat.c
index 8895cf7..5b95e8d 100644
--- a/src/ocat.c
+++ b/src/ocat.c
@@ -270,12 +270,19 @@ void cleanup_system(void)
}
-void parse_opt_early(int argc, char *argv[])
+void parse_opt_early(int argc, char *argv_orig[])
{
int c;
+ char *argv[argc + 1];
+ log_debug("parse_opt_early()");
+ // argv array is copied to prevent the original one from being modified by
+ // getopt(). This behavior is at least true for Linux.
+ memcpy(&argv, argv_orig, sizeof(char*) * (argc + 1));
opterr = 0;
while ((c = getopt(argc, argv, "f:I")) != -1)
+ {
+ log_debug("getopt(): c = %c, optind = %d, opterr = %d, optarg = \"%s\"", c, optind, opterr, optarg);
switch (c)
{
case 'f':
@@ -290,6 +297,7 @@ void parse_opt_early(int argc, char *argv[])
case '?':
break;
}
+ }
}
@@ -297,9 +305,12 @@ int parse_opt(int argc, char *argv[])
{
int c, urlconv = 0;
+ log_debug("parse_opt_early()");
opterr = 1;
optind = 1;
while ((c = getopt(argc, argv, "f:IabBCd:hrRiopl:t:T:s:u:4L:P:")) != -1)
+ {
+ log_debug("getopt(): c = %c, optind = %d, opterr = %d, optarg = \"%s\"", c, optind, opterr, optarg);
switch (c)
{
// those options are parsed in parse_opt_early()
@@ -398,6 +409,7 @@ int parse_opt(int argc, char *argv[])
usage(argv[0]);
exit(1);
}
+ }
return urlconv;
}
@@ -422,6 +434,9 @@ int main(int argc, char *argv[])
mode_detect = 1;
}
+#ifdef DEBUG
+ for (c = 0; c < argc; c++) log_debug("argv[%d] = \"%s\"", c, argv[c]);
+#endif
parse_opt_early(argc, argv);
if (!mode_detect)
@@ -438,7 +453,9 @@ int main(int argc, char *argv[])
else
ctrl_handler((void*) (long) c);
-
+#ifdef DEBUG
+ for (c = 0; c < argc; c++) log_debug("argv[%d] = \"%s\"", c, argv[c]);
+#endif
urlconv = parse_opt(argc, argv);
// usage output must be after mode detection (Tor/I2P)
@@ -479,6 +496,7 @@ int main(int argc, char *argv[])
}
// copy onion-URL from command line
+ log_debug("argv[%d] = \"%s\"", optind, argv[optind]);
if (!CNF(rand_addr))
strncpy(CNF(onion_url), argv[optind], NDESC(name_size));
// ...or generate a random one
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-privacy/packages/onioncat.git
More information about the Pkg-privacy-commits
mailing list