From e5e0bc557a2aabb8b1173144ba602b7b874dc9ab Mon Sep 17 00:00:00 2001 From: Arjun Sreedharan Date: Thu, 4 Dec 2014 14:26:04 +0530 Subject: [PATCH] tests: try again when waitpid() sets errno as EINTR MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit when waitpid() is interrupted, errno is not set to the negative value -EINTR. It is set to EINTR. check against EINTR. Signed-off-by: Arjun Sreedharan Acked-by: Stéphane Graber --- src/tests/containertests.c | 4 ++-- src/tests/destroytest.c | 2 +- src/tests/saveconfig.c | 2 +- src/tests/startone.c | 4 ++-- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/tests/containertests.c b/src/tests/containertests.c index 923085350..d093a02a8 100644 --- a/src/tests/containertests.c +++ b/src/tests/containertests.c @@ -48,7 +48,7 @@ static int destroy_busybox(void) again: ret = waitpid(pid, &status, 0); if (ret == -1) { - if (errno == -EINTR) + if (errno == EINTR) goto again; perror("waitpid"); return -1; @@ -80,7 +80,7 @@ static int create_busybox(void) again: ret = waitpid(pid, &status, 0); if (ret == -1) { - if (errno == -EINTR) + if (errno == EINTR) goto again; perror("waitpid"); return -1; diff --git a/src/tests/destroytest.c b/src/tests/destroytest.c index 4bb6aaead..eaf3c84d0 100644 --- a/src/tests/destroytest.c +++ b/src/tests/destroytest.c @@ -46,7 +46,7 @@ static int create_container(void) again: ret = waitpid(pid, &status, 0); if (ret == -1) { - if (errno == -EINTR) + if (errno == EINTR) goto again; perror("waitpid"); return -1; diff --git a/src/tests/saveconfig.c b/src/tests/saveconfig.c index de2fa82b6..d8a4ca271 100644 --- a/src/tests/saveconfig.c +++ b/src/tests/saveconfig.c @@ -46,7 +46,7 @@ static int create_container(void) again: ret = waitpid(pid, &status, 0); if (ret == -1) { - if (errno == -EINTR) + if (errno == EINTR) goto again; perror("waitpid"); return -1; diff --git a/src/tests/startone.c b/src/tests/startone.c index 9dd4ec3e6..6b7344f66 100644 --- a/src/tests/startone.c +++ b/src/tests/startone.c @@ -48,7 +48,7 @@ static int destroy_container(void) again: ret = waitpid(pid, &status, 0); if (ret == -1) { - if (errno == -EINTR) + if (errno == EINTR) goto again; perror("waitpid"); return -1; @@ -80,7 +80,7 @@ static int create_container(void) again: ret = waitpid(pid, &status, 0); if (ret == -1) { - if (errno == -EINTR) + if (errno == EINTR) goto again; perror("waitpid"); return -1; -- 2.47.2