[CRIU] [PATCH] zdtm/poll: don't overwrite errno

Cyrill Gorcunov gorcunov at gmail.com
Wed Mar 25 13:52:47 PDT 2015


On Wed, Mar 25, 2015 at 11:43:59PM +0300, Andrey Vagin wrote:
> show_pollfd() overwrites errno and the test fails
> 
> 20:38:58.876:     4:  0) fd:  5 events  1 revents  0
> 20:38:58.876:     4:  1) fd:  6 events  1 revents  0
> 20:38:58.876:     4:     Init: sec           1427315938 nsec 876822
> 20:38:58.876:     5:    Start: sec           1427315938 nsec 876899
> 20:39:00.066:     5:  0) fd:  5 events  1 revents  0
> 20:39:00.066:     5:  1) fd:  6 events  1 revents  0
> 20:39:00.067:     5: ERR: poll.c:88: Poll-2 returned -1 (events?!) (errno = 13 (Permission denied))
> 
> Reported-by: Mr Jenkins
> Signed-off-by: Andrey Vagin <avagin at openvz.org>
> ---
>  test/zdtm/live/static/poll.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/test/zdtm/live/static/poll.c b/test/zdtm/live/static/poll.c
> index 85f5455..8e06887 100644
> --- a/test/zdtm/live/static/poll.c
> +++ b/test/zdtm/live/static/poll.c
> @@ -83,8 +83,8 @@ int main(int argc, char *argv[])
>  		delta = 5;
>  		while (test_go()) {
>  			ret = poll(ufds, 2, delta * 1000);
> -			show_pollfd(ufds, 2);
>  			if (ret && errno != EINTR) {
> +				show_pollfd(ufds, 2);
>  				err("Poll-2 returned %d (events?!)", ret);
>  				exit(1);
>  			}

Sigh, so the test_msg does overwrite errno, what the fsck?!
Really, guys, I think we should fix this kind of crap.


More information about the CRIU mailing list