ctdb: close the correct pipe fd in a test
authorRalph Boehme <slow@samba.org>
Tue, 19 Jun 2018 08:35:04 +0000 (10:35 +0200)
committerJeremy Allison <jra@samba.org>
Tue, 10 Jul 2018 18:31:13 +0000 (20:31 +0200)
This was discovered in an autobuild with a patched tevent that used the
"poll" backend by default. Test failure:

$ bin/sock_daemon_test /dev/shm/sock_daemon_test.pid /dev/shm/sock_daemon_test.sock 5
test5[28011]: daemon started, pid=28011
test5[28011]: listening on /dev/shm/sock_daemon_test.sock
sock_daemon_test: ../ctdb/tests/src/sock_daemon_test.c:980: test5: Assertion `ret == i+1' failed.
Abgebrochen (Speicherabzug geschrieben)
metze@SERNOX14:~/devel/samba/4.0/master4-test$ test5[28011]: PID 28010 gone away, exiting
test5[28011]: Shutting down
sock_daemon_test: ../ctdb/tests/src/sock_daemon_test.c:964: test5:
Assertion `ret == EINTR' failed.

After an epic debugging session we spotted the problem.

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
ctdb/tests/src/sock_daemon_test.c

index 916ba2236f034206253cb42774cdb6d3e34ceb4e..80004b41c917add29b7f18871c748a9f8e921b5b 100644 (file)
@@ -759,7 +759,7 @@ static int test5_client(const char *sockpath, int id, pid_t pid_server,
                        tevent_loop_once(ev);
                }
 
-               close(fd[0]);
+               close(fd[1]);
                state.fd = -1;
 
                while (kill(pid_server, 0) == 0 || errno != ESRCH) {