/****************************************************************************
Close all conn structures.
+return true if any were closed
****************************************************************************/
-
-void conn_close_all(void)
+bool conn_close_all(void)
{
connection_struct *conn, *next;
+ bool ret = false;
for (conn=Connections;conn;conn=next) {
next=conn->next;
set_current_service(conn, 0, True);
close_cnum(conn, conn->vuid);
+ ret = true;
}
+ return ret;
}
/****************************************************************************
/* a child terminated uncleanly so tickle all processes to see
if they can grab any of the pending locks
*/
- DEBUG(0,(__location__ " Unclean shutdown of pid %u\n", pid));
+ DEBUG(3,(__location__ " Unclean shutdown of pid %u\n", pid));
messaging_send_buf(smbd_messaging_context(), procid_self(),
MSG_SMB_BRL_VALIDATE, NULL, 0);
message_send_all(smbd_messaging_context(),
const char *const reason)
{
static int firsttime=1;
+ bool had_open_conn;
if (!firsttime)
exit(0);
(negprot_global_auth_context->free)(&negprot_global_auth_context);
}
- conn_close_all();
+ had_open_conn = conn_close_all();
invalidate_all_vuids();
(reason ? reason : "normal exit")));
}
- exit(0);
+ if (had_open_conn) {
+ exit(1);
+ } else {
+ exit(0);
+ }
}
void exit_server(const char *const explanation)