Tests fix: Missing waitpid in fork test
authorJérémie Galarneau <jeremie.galarneau@efficios.com>
Wed, 26 Feb 2014 15:56:57 +0000 (10:56 -0500)
committerDavid Goulet <dgoulet@efficios.com>
Wed, 26 Feb 2014 18:36:43 +0000 (13:36 -0500)
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Signed-off-by: David Goulet <dgoulet@efficios.com>
tests/regression/ust/fork/fork.c

index 744e9203e9dfb65e891d6f518cc7cfe679df01d4..7df982b4db2d74ce73aa17ae0d18fca78f3f6f23 100644 (file)
@@ -20,6 +20,7 @@
 #include <stdio.h>
 #include <unistd.h>
 #include <sys/types.h>
+#include <sys/wait.h>
 #include <stdlib.h>
 
 #define TRACEPOINT_DEFINE
@@ -51,12 +52,19 @@ int main(int argc, char **argv, char *env[])
                result = execve(argv[1], args, env);
                if (result == -1) {
                        perror("execve");
-                       return 1;
+                       result = 1;
+                       goto end;
                }
        } else {
                printf("child_pid %d\n", result);
                tracepoint(ust_tests_fork, after_fork_parent, getpid());
+               if (waitpid(result, NULL, 0) < 0) {
+                       perror("waitpid");
+                       result = 1;
+                       goto end;
+               }
        }
-
-       return 0;
+       result = 0;
+end:
+       return result;
 }
This page took 0.025487 seconds and 4 git commands to generate.