BUG: https://bugzilla.samba.org/show_bug.cgi?id=12109
To create a client process that waits after connect(), instead of trying
to do a blocking write(), go to sleep. The parent can then kill the client
process, once testing is done.
Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
return client;
}
-static int socket_client_write(int client)
-{
- int ret;
-
- ret = sys_write(client, "\0", 1);
- assert(ret == 1);
-
- return 0;
-}
-
static int socket_client_close(int client)
{
int ret;
assert(pid != -1);
if (pid == 0) { // Child
+ pid = getppid();
client = socket_client_connect();
- socket_client_write(client);
+ while (kill(pid, 0) == 0) {
+ sleep(1);
+ }
socket_client_close(client);
exit(0);
} else {
assert(peer_pid == globals.helper_pid);
+ kill(peer_pid, SIGTERM);
+
close(fd);
return 0;
}