tdb: Fix tdb_runtime_check_for_robust_mutexes()
authorVolker Lendecke <vl@samba.org>
Wed, 26 Nov 2014 15:35:19 +0000 (15:35 +0000)
committerVolker Lendecke <vl@samba.org>
Wed, 26 Nov 2014 15:43:04 +0000 (16:43 +0100)
When using exit() instead of _exit(), the child will flush buffered stdout
(and other stdio) content that it inherited from the parent process. In
make test, this led to duplicate output from net registry which then
confused the blackbox selftest.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
lib/tdb/common/mutex.c

index bdc4c28cb6c23f53d94e591d2ad99d6a3669cc67..12f89d3b3da7e2990a9512cad96f291de60342e3 100644 (file)
@@ -814,17 +814,17 @@ _PUBLIC_ bool tdb_runtime_check_for_robust_mutexes(void)
                ret = pthread_mutex_lock(m);
                nwritten = write(pipe_up[1], &ret, sizeof(ret));
                if (nwritten != sizeof(ret)) {
-                       exit(1);
+                       _exit(1);
                }
                if (ret != 0) {
-                       exit(1);
+                       _exit(1);
                }
                nread = read(pipe_down[0], &c, 1);
                if (nread != 1) {
-                       exit(1);
+                       _exit(1);
                }
                /* leave locked */
-               exit(0);
+               _exit(0);
        }
        if (tdb_robust_mutex_pid == -1) {
                goto cleanup_sig_child;