From: Arjun Sreedharan Date: Thu, 4 Dec 2014 08:56:04 +0000 (+0530) Subject: tests: try again when waitpid() sets errno as EINTR X-Git-Tag: lxc-1.0.7~4 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=e5e0bc557a2aabb8b1173144ba602b7b874dc9ab;p=thirdparty%2Flxc.git tests: try again when waitpid() sets errno as EINTR 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 --- 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;