Author: metze Date: 2007-08-22 12:06:54 +0000 (Wed, 22 Aug 2007) New Revision: 24622
WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=24622 Log: - deferr calling build_options();exit(0); - use poptPrintUsage() to give the user more info metze Modified: branches/SAMBA_3_2_0/source/nmbd/nmbd.c branches/SAMBA_3_2_0/source/nsswitch/winbindd.c branches/SAMBA_3_2_0/source/smbd/server.c Changeset: Modified: branches/SAMBA_3_2_0/source/nmbd/nmbd.c =================================================================== --- branches/SAMBA_3_2_0/source/nmbd/nmbd.c 2007-08-22 12:06:27 UTC (rev 24621) +++ branches/SAMBA_3_2_0/source/nmbd/nmbd.c 2007-08-22 12:06:54 UTC (rev 24622) @@ -681,8 +681,9 @@ while ((opt = poptGetNextOpt(pc)) != -1) { switch (opt) { default: - d_fprintf(stderr, "\nInvalid option %s: %s\n", + d_fprintf(stderr, "\nInvalid option %s: %s\n\n", poptBadOption(pc, 0), poptStrerror(opt)); + poptPrintUsage(pc, stderr, 0); exit(1); } }; Modified: branches/SAMBA_3_2_0/source/nsswitch/winbindd.c =================================================================== --- branches/SAMBA_3_2_0/source/nsswitch/winbindd.c 2007-08-22 12:06:27 UTC (rev 24621) +++ branches/SAMBA_3_2_0/source/nsswitch/winbindd.c 2007-08-22 12:06:54 UTC (rev 24622) @@ -986,8 +986,9 @@ Fork = False; break; default: - d_fprintf(stderr, "\nInvalid option %s: %s\n", + d_fprintf(stderr, "\nInvalid option %s: %s\n\n", poptBadOption(pc, 0), poptStrerror(opt)); + poptPrintUsage(pc, stderr, 0); exit(1); } } @@ -998,6 +999,8 @@ exit(1); } + poptFreeContext(pc); + if (!override_logfile) { pstr_sprintf(logfile, "%s/log.winbindd", dyn_LOGFILEBASE); lp_set_logfile(logfile); @@ -1124,8 +1127,6 @@ messaging_register(winbind_messaging_context(), NULL, MSG_DUMP_EVENT_LIST, winbind_msg_dump_event_list); - poptFreeContext(pc); - netsamlogon_cache_init(); /* Non-critical */ /* clear the cached list of trusted domains */ Modified: branches/SAMBA_3_2_0/source/smbd/server.c =================================================================== --- branches/SAMBA_3_2_0/source/smbd/server.c 2007-08-22 12:06:27 UTC (rev 24621) +++ branches/SAMBA_3_2_0/source/smbd/server.c 2007-08-22 12:06:54 UTC (rev 24622) @@ -861,6 +861,7 @@ static char *profile_level = NULL; int opt; poptContext pc; + BOOL print_build_options = False; struct poptOption long_options[] = { POPT_AUTOHELP @@ -886,21 +887,25 @@ #endif pc = poptGetContext("smbd", argc, argv, long_options, 0); - while((opt = poptGetNextOpt(pc)) != -1) { switch (opt) { case 'b': - build_options(True); /* Display output to screen as well as debug */ - exit(0); + print_build_options = True; + break; default: - d_fprintf(stderr, "\nInvalid option %s: %s\n", + d_fprintf(stderr, "\nInvalid option %s: %s\n\n", poptBadOption(pc, 0), poptStrerror(opt)); + poptPrintUsage(pc, stderr, 0); exit(1); } } - poptFreeContext(pc); + if (print_build_options) { + build_options(True); /* Display output to screen as well as debug */ + exit(0); + } + #ifdef HAVE_SETLUID /* needed for SecureWare on SCO */ setluid(0);