s3:torture: in LOCAL-MESSAGING-READ3, tell child to exit and wait
authorMichael Adam <obnox@samba.org>
Tue, 23 Sep 2014 07:51:40 +0000 (09:51 +0200)
committerMichael Adam <obnox@samba.org>
Wed, 24 Sep 2014 06:44:12 +0000 (08:44 +0200)
Signed-off-by: Michael Adam <obnox@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
source3/torture/test_messaging_read.c

index 757b83eb341415c540472aa8713b4dc7c0ca8ba0..a51ae4f1b3b80e4dd00a7b81690c1a2ed81aad09 100644 (file)
@@ -396,6 +396,7 @@ bool run_messaging_read3(int dummy)
        int ret;
        char c;
        struct server_id dst;
+       ssize_t written;
 
        if ((pipe(ready_pipe) != 0) || (pipe(exit_pipe) != 0)) {
                perror("pipe failed");
@@ -442,6 +443,22 @@ bool run_messaging_read3(int dummy)
                goto fail;
        }
 
+       printf("Parent: telling child to exit\n");
+
+       written = write(exit_pipe[1], &c, 1);
+       if (written != 1) {
+               perror("write to exit_pipe failed");
+               goto fail;
+       }
+
+       ret = waitpid(child, NULL, 0);
+       if (ret == -1) {
+               perror("waitpid failed");
+               goto fail;
+       }
+
+       printf("Parent: child exited. Done\n");
+
        retval = true;
 fail:
        TALLOC_FREE(msg_ctx);