1
0
mirror of https://github.com/samba-team/samba.git synced 2025-01-11 05:18:09 +03:00

r6846: make smbd terminate immediately on EOF from stdin

this will be used to make sure 'make test' kills smbd when finished
This commit is contained in:
Andrew Tridgell 2005-05-17 06:20:54 +00:00 committed by Gerald (Jerry) Carter
parent 257027a571
commit ddbb549563

View File

@ -124,6 +124,19 @@ static void setup_signals(void)
}
/*
handle io on stdin
*/
static void server_stdin_handler(struct event_context *event_ctx, struct fd_event *fde,
uint16_t flags, void *private)
{
uint8_t c;
if (read(0, &c, 1) == 0) {
DEBUG(0,("EOF on stdin - terminating\n"));
exit(0);
}
}
/*
main server.
*/
@ -200,6 +213,9 @@ static int binary_smbd_main(int argc, const char *argv[])
should hang off that */
event_ctx = event_context_init(NULL);
/* catch EOF on stdin */
event_add_fd(event_ctx, event_ctx, 0, EVENT_FD_READ, server_stdin_handler, NULL);
DEBUG(0,("Using %s process model\n", model));
status = server_service_startup(event_ctx, model, lp_server_services());
if (!NT_STATUS_IS_OK(status)) {