[CRIU] [PATCH] criu: print correct errno messages from pr_perror()

Pavel Emelyanov xemul at parallels.com
Thu Feb 12 10:56:01 PST 2015


On 02/12/2015 09:24 PM, Andrey Vagin wrote:
> "%m" can't be used to print strerror(errno), because print_on_level()
> calls gettimeofday() which can overwrite errno.
> 
> For example:
> 13486 connect(4, {sa_family=AF_INET, sin_port=htons(8880), sin_addr=inet_addr("127.0.0.1")}, 16) = -1 ENETUNREACH (Network is unreachable)
> 13486 gettimeofday({1423756664, 717423}, NULL) = 0
> 13486 open("/etc/localtime", O_RDONLY|O_CLOEXEC) = -1 EACCES (Permission denied)
> 13486 write(2, "15:57:44.717:     4: ERR: socket_udp.c:73: Can't connect (errno = 101 (Permission denied))\n", 91) = 91
> 
> Signed-off-by: Andrey Vagin <avagin at openvz.org>

The same exists in zdtm library. When test's syscall fails, the
call to fail() prints bogus errno.



More information about the CRIU mailing list