1
0
mirror of https://github.com/samba-team/samba.git synced 2025-09-17 05:44:20 +03:00

r24621: - deferr calling build_options();exit(0);

- use poptPrintUsage() to give the user more info

metze
This commit is contained in:
Stefan Metzmacher
2007-08-22 12:06:27 +00:00
committed by Gerald (Jerry) Carter
parent c115de4bea
commit a95d9d1ef9
3 changed files with 16 additions and 9 deletions

View File

@@ -678,8 +678,9 @@ static BOOL open_sockets(enum smb_server_mode server_mode, int port)
while ((opt = poptGetNextOpt(pc)) != -1) { while ((opt = poptGetNextOpt(pc)) != -1) {
switch (opt) { switch (opt) {
default: default:
d_fprintf(stderr, "\nInvalid option %s: %s\n", d_fprintf(stderr, "\nInvalid option %s: %s\n\n",
poptBadOption(pc, 0), poptStrerror(opt)); poptBadOption(pc, 0), poptStrerror(opt));
poptPrintUsage(pc, stderr, 0);
exit(1); exit(1);
} }
}; };

View File

@@ -1017,8 +1017,9 @@ int main(int argc, char **argv, char **envp)
while ((opt = poptGetNextOpt(pc)) != -1) { while ((opt = poptGetNextOpt(pc)) != -1) {
switch (opt) { switch (opt) {
default: default:
d_fprintf(stderr, "\nInvalid option %s: %s\n", d_fprintf(stderr, "\nInvalid option %s: %s\n\n",
poptBadOption(pc, 0), poptStrerror(opt)); poptBadOption(pc, 0), poptStrerror(opt));
poptPrintUsage(pc, stderr, 0);
exit(1); exit(1);
} }
} }
@@ -1036,6 +1037,8 @@ int main(int argc, char **argv, char **envp)
exit(1); exit(1);
} }
poptFreeContext(pc);
if (!override_logfile) { if (!override_logfile) {
pstr_sprintf(logfile, "%s/log.winbindd", dyn_LOGFILEBASE); pstr_sprintf(logfile, "%s/log.winbindd", dyn_LOGFILEBASE);
lp_set_logfile(logfile); lp_set_logfile(logfile);
@@ -1167,8 +1170,6 @@ int main(int argc, char **argv, char **envp)
messaging_register(winbind_messaging_context(), NULL, messaging_register(winbind_messaging_context(), NULL,
MSG_DUMP_EVENT_LIST, winbind_msg_dump_event_list); MSG_DUMP_EVENT_LIST, winbind_msg_dump_event_list);
poptFreeContext(pc);
netsamlogon_cache_init(); /* Non-critical */ netsamlogon_cache_init(); /* Non-critical */
/* clear the cached list of trusted domains */ /* clear the cached list of trusted domains */

View File

@@ -818,6 +818,7 @@ extern void build_options(BOOL screen);
const char *profile_level = NULL; const char *profile_level = NULL;
int opt; int opt;
poptContext pc; poptContext pc;
BOOL print_build_options = False;
enum smb_server_mode server_mode = SERVER_MODE_DAEMON; enum smb_server_mode server_mode = SERVER_MODE_DAEMON;
@@ -849,21 +850,25 @@ extern void build_options(BOOL screen);
#endif #endif
pc = poptGetContext("smbd", argc, argv, long_options, 0); pc = poptGetContext("smbd", argc, argv, long_options, 0);
while((opt = poptGetNextOpt(pc)) != -1) { while((opt = poptGetNextOpt(pc)) != -1) {
switch (opt) { switch (opt) {
case 'b': case 'b':
build_options(True); /* Display output to screen as well as debug */ print_build_options = True;
exit(0); break;
default: default:
d_fprintf(stderr, "\nInvalid option %s: %s\n", d_fprintf(stderr, "\nInvalid option %s: %s\n\n",
poptBadOption(pc, 0), poptStrerror(opt)); poptBadOption(pc, 0), poptStrerror(opt));
poptPrintUsage(pc, stderr, 0);
exit(1); exit(1);
} }
} }
poptFreeContext(pc); poptFreeContext(pc);
if (print_build_options) {
build_options(True); /* Display output to screen as well as debug */
exit(0);
}
#ifdef HAVE_SETLUID #ifdef HAVE_SETLUID
/* needed for SecureWare on SCO */ /* needed for SecureWare on SCO */
setluid(0); setluid(0);