diff options
author | Chris Wilson <chris+github@qwirx.com> | 2007-07-03 21:13:56 +0000 |
---|---|---|
committer | Chris Wilson <chris+github@qwirx.com> | 2007-07-03 21:13:56 +0000 |
commit | ea9109761619772853bac35fa538ab5af0877377 (patch) | |
tree | f4113115928054063a4d49930113452b06c7fdb2 /lib | |
parent | 9abeb07ffc1ef91bc351f11f3d2d078e62ce2ae6 (diff) |
Hopefully work around buggy getopt implementation noted by TBP in
http://lists.warhead.org.uk/pipermail/boxbackup/2007-July/003614.html
(refs #3)
Diffstat (limited to 'lib')
-rw-r--r-- | lib/server/Daemon.cpp | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/lib/server/Daemon.cpp b/lib/server/Daemon.cpp index 66b317d5..bc591f3b 100644 --- a/lib/server/Daemon.cpp +++ b/lib/server/Daemon.cpp @@ -124,12 +124,21 @@ int Daemon::Main(const char *DefaultConfigFile, int argc, const char *argv[]) while((c = getopt(argc, (char * const *)argv, "c:DFqvVt:Tk")) != -1) { - BOX_TRACE("getopt: returned '" << c << "'"); + BOX_TRACE("getopt: returned '" << c << "' (" << (int)c << ")"); BOX_TRACE("getopt: optind = " << optind); BOX_TRACE("getopt: optopt = " << optopt); BOX_TRACE("getopt: optarg = " << optarg); BOX_TRACE("getopt: argv[optind] = " << argv[optind]); + // Workaround for weird behaviour noted by TBP in + // http://lists.warhead.org.uk/pipermail/boxbackup/2007-July/003614.html + if (c == '?' && optopt == 0) + { + // this apparently means "end of options" in some + // buggy libc? + break; + } + switch(c) { case 'c': |