svn commit: samba r6846 - in branches/SAMBA_4_0/source/smbd: .
tridge at samba.org
tridge at samba.org
Tue May 17 06:20:55 GMT 2005
Author: tridge
Date: 2005-05-17 06:20:54 +0000 (Tue, 17 May 2005)
New Revision: 6846
WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=6846
Log:
make smbd terminate immediately on EOF from stdin
this will be used to make sure 'make test' kills smbd when finished
Modified:
branches/SAMBA_4_0/source/smbd/server.c
Changeset:
Modified: branches/SAMBA_4_0/source/smbd/server.c
===================================================================
--- branches/SAMBA_4_0/source/smbd/server.c 2005-05-17 05:48:30 UTC (rev 6845)
+++ branches/SAMBA_4_0/source/smbd/server.c 2005-05-17 06:20:54 UTC (rev 6846)
@@ -125,6 +125,19 @@
/*
+ 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.
*/
static int binary_smbd_main(int argc, const char *argv[])
@@ -200,6 +213,9 @@
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)) {
More information about the samba-cvs
mailing list