summaryrefslogtreecommitdiff
path: root/lib/server
diff options
context:
space:
mode:
authorChris Wilson <chris+github@qwirx.com>2007-11-07 21:06:55 +0000
committerChris Wilson <chris+github@qwirx.com>2007-11-07 21:06:55 +0000
commit7d540ec3e13b6a48868044c72cd3511b8ae02457 (patch)
tree49dd72b30842a29b691bd64191c91789cce20da3 /lib/server
parentc5847429a0d0f277502525e749aca221097045e1 (diff)
Fix getopt reset for solaris and maybe other platforms. See
http://lists.debian.org/debian-glibc/2004/10/msg00070.html.
Diffstat (limited to 'lib/server')
-rw-r--r--lib/server/Daemon.cpp8
1 files changed, 5 insertions, 3 deletions
diff --git a/lib/server/Daemon.cpp b/lib/server/Daemon.cpp
index cd817e80..49057d91 100644
--- a/lib/server/Daemon.cpp
+++ b/lib/server/Daemon.cpp
@@ -276,11 +276,13 @@ int Daemon::Main(const char *DefaultConfigFile, int argc, const char *argv[])
// reset getopt, just in case anybody used it before.
// unfortunately glibc and BSD differ on this point!
// http://www.ussg.iu.edu/hypermail/linux/kernel/0305.3/0262.html
- #ifdef __GLIBC__
- optind = 0;
- #else
+ #if HAVE_DECL_OPTRESET == 1
optind = 1;
optreset = 1;
+ #elif defined __GLIBC__
+ optind = 0;
+ #else // Solaris, any others?
+ optind = 1;
#endif
while((c = getopt(argc, (char * const *)argv,