mirror of
https://github.com/samba-team/samba.git
synced 2025-01-10 01:18:15 +03:00
Handle a client that exited correctly: We need to ignore SIGPIPE and when the
read returns 0 bytes this means the client has exited. Close the connection then. (This used to be ctdb commit bd10f4e62146493848258df8a3dc3b9222337a12)
This commit is contained in:
parent
f2d13d0ea9
commit
6f2b236909
@ -283,6 +283,11 @@ static void ctdb_client_read_cb(uint8_t *data, size_t cnt, void *args)
|
||||
struct ctdb_client *client = talloc_get_type(args, struct ctdb_client);
|
||||
struct ctdb_req_header *hdr;
|
||||
|
||||
if (cnt == 0) {
|
||||
talloc_free(client);
|
||||
return;
|
||||
}
|
||||
|
||||
if (cnt < sizeof(*hdr)) {
|
||||
ctdb_set_error(client->ctdb, "Bad packet length %d\n", cnt);
|
||||
return;
|
||||
|
@ -22,6 +22,19 @@
|
||||
#include "lib/events/events.h"
|
||||
#include "system/filesys.h"
|
||||
#include "popt.h"
|
||||
#include <signal.h>
|
||||
|
||||
static void block_signal(int signum)
|
||||
{
|
||||
struct sigaction act;
|
||||
|
||||
memset(&act, 0, sizeof(act));
|
||||
|
||||
act.sa_handler = SIG_IGN;
|
||||
sigemptyset(&act.sa_mask);
|
||||
sigaddset(&act.sa_mask, signum);
|
||||
sigaction(signum, &act, NULL);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
@ -75,6 +88,8 @@ int main(int argc, const char *argv[])
|
||||
exit(1);
|
||||
}
|
||||
|
||||
block_signal(SIGPIPE);
|
||||
|
||||
ev = event_context_init(NULL);
|
||||
|
||||
/* initialise ctdb */
|
||||
|
Loading…
Reference in New Issue
Block a user