[Box Backup-commit] COMMIT r1695 - box/chris/merge/lib/server
boxbackup-dev at fluffy.co.uk
boxbackup-dev at fluffy.co.uk
Mon Jun 4 22:13:34 BST 2007
Author: chris
Date: 2007-06-04 22:13:34 +0100 (Mon, 04 Jun 2007)
New Revision: 1695
Modified:
box/chris/merge/lib/server/Daemon.cpp
Log:
Hopefully reset getopt in a way that's compatible with BSD and GLIBC,
thanks to Tobias Balle-Petersen for pointing out this bug.
Modified: box/chris/merge/lib/server/Daemon.cpp
===================================================================
--- box/chris/merge/lib/server/Daemon.cpp 2007-06-03 14:37:48 UTC (rev 1694)
+++ box/chris/merge/lib/server/Daemon.cpp 2007-06-04 21:13:34 UTC (rev 1695)
@@ -110,8 +110,17 @@
#endif
char c;
- optind = 0; // just in case anybody used getopt before
+ // 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 = 1;
+ #else
+ optind = 0;
+ optreset = 1;
+ #endif
+
while((c = getopt(argc, (char * const *)argv, "c:DqvVt:Tk")) != -1)
{
switch(c)
More information about the Boxbackup-commit
mailing list