Commit 9152dd21 authored by Vitaly Ostrosablin's avatar Vitaly Ostrosablin Committed by Pavel Emelyanov

test: remap_dead_pid.c: Fix child PID not being printed

There's two issues with this code:

1. Child task is killed by parent faster, than it could print the line.
2. Even if it had time to print it - there would always be 0, because
it's called from child process.

Obviously, this print was meant to be in parent process. So, let's move
it there.
Signed-off-by: 's avatarVitaly Ostrosablin <vostrosablin@virtuozzo.com>
Signed-off-by: 's avatarAndrei Vagin <avagin@virtuozzo.com>
parent 833fa4d7
...@@ -35,12 +35,13 @@ int main(int argc, char **argv) ...@@ -35,12 +35,13 @@ int main(int argc, char **argv)
} }
if (pid == 0) { if (pid == 0) {
test_msg("child is %d\n", pid);
/* Child process just sleeps until it is killed. All we need /* Child process just sleeps until it is killed. All we need
* here is a process to open the mountinfo of. */ * here is a process to open the mountinfo of. */
while(1) while(1)
sleep(10); sleep(10);
} else { } else {
test_msg("child is %d\n", pid);
int fd, ret; int fd, ret;
char path[PATH_MAX]; char path[PATH_MAX];
pid_t result; pid_t result;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment