[CRIU] [PATCH 5/7] zdtm/test: add infop to waitid()
Dmitry Safonov
dsafonov at virtuozzo.com
Mon Jan 9 09:19:10 PST 2017
The man page says, it's not optional argument:
The application shall ensure that the infop argument
points to a siginfo_t structure.
Fixes:
Test output: ================================
17:40:26.128: 5: FAIL: helper_zombie_child.c:33: waitid (errno = 14 (Bad address))
17:40:26.128: 4: FAIL: helper_zombie_child.c:78: read (errno = 2 (No such file or directory))
17:40:26.129: 3: ERR: test.c:229: Test exited unexpectedly with code 1
Test output: ================================
15:30:49.021: 30: ERR: sigpending.c:213: waitid (errno = 14 (Bad address))
15:30:49.021: 29: ERR: test.c:229: Test exited unexpectedly with code 1
and etc.
Signed-off-by: Dmitry Safonov <dsafonov at virtuozzo.com>
---
test/zdtm/static/helper_zombie_child.c | 3 ++-
test/zdtm/static/sigpending.c | 3 ++-
test/zdtm/static/stopped.c | 3 ++-
3 files changed, 6 insertions(+), 3 deletions(-)
diff --git a/test/zdtm/static/helper_zombie_child.c b/test/zdtm/static/helper_zombie_child.c
index 18227189bdf9..1e6b4bda7117 100644
--- a/test/zdtm/static/helper_zombie_child.c
+++ b/test/zdtm/static/helper_zombie_child.c
@@ -16,6 +16,7 @@ const char *test_author = "Tycho Andersen <tycho.andersen at canonical.com>";
void setsid_and_fork(int sk)
{
+ siginfo_t infop;
pid_t zombie;
setsid();
@@ -29,7 +30,7 @@ void setsid_and_fork(int sk)
if (zombie == 0)
exit(0);
- if (waitid(P_PID, zombie, NULL, WNOWAIT | WEXITED) < 0) {
+ if (waitid(P_PID, zombie, &infop, WNOWAIT | WEXITED) < 0) {
fail("waitid");
exit(1);
}
diff --git a/test/zdtm/static/sigpending.c b/test/zdtm/static/sigpending.c
index 2a4abfba024c..d1dbd251daed 100644
--- a/test/zdtm/static/sigpending.c
+++ b/test/zdtm/static/sigpending.c
@@ -170,6 +170,7 @@ int main(int argc, char ** argv)
sigset_t blockmask, oldset, newset;
struct sigaction act;
pthread_t pthrd;
+ siginfo_t infop;
int i;
memset(&oldset, 0, sizeof(oldset));
@@ -209,7 +210,7 @@ int main(int argc, char ** argv)
if(child == 0)
return 5; /* SIGCHLD */
- if (waitid(P_PID, child, NULL, WNOWAIT | WEXITED)) {
+ if (waitid(P_PID, child, &infop, WNOWAIT | WEXITED)) {
pr_perror("waitid");
return 1;
}
diff --git a/test/zdtm/static/stopped.c b/test/zdtm/static/stopped.c
index af5780793dd2..9bb849363aaf 100644
--- a/test/zdtm/static/stopped.c
+++ b/test/zdtm/static/stopped.c
@@ -13,6 +13,7 @@ const char *test_author = "Andrew Vagin <avagin at parallels.com>";
int main(int argc, char **argv)
{
pid_t pid;
+ siginfo_t infop;
int p[2], ret, status;
test_init(argc, argv);
@@ -40,7 +41,7 @@ int main(int argc, char **argv)
close(p[0]);
kill(pid, SIGSTOP);
- if (waitid(P_PID, pid, NULL, WNOWAIT | WSTOPPED) < 0) {
+ if (waitid(P_PID, pid, &infop, WNOWAIT | WSTOPPED) < 0) {
pr_perror("waitid");
return 1;
}
--
2.11.0
More information about the CRIU
mailing list