[lxc-devel] [PATCH] tests: try again when waitpid() sets errno as EINTR
Stéphane Graber
stgraber at ubuntu.com
Thu Dec 4 16:47:23 UTC 2014
On Thu, Dec 04, 2014 at 02:26:04PM +0530, Arjun Sreedharan wrote:
> 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 <arjun024 at gmail.com>
Acked-by: Stéphane Graber <stgraber at ubuntu.com>
> ---
> 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 9230853..d093a02 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 4bb6aae..eaf3c84 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 de2fa82..d8a4ca2 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 9dd4ec3..6b7344f 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;
> --
> 1.7.10.1
>
--
Stéphane Graber
Ubuntu developer
http://www.ubuntu.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20141204/7486835e/attachment.sig>
More information about the lxc-devel
mailing list