From bcb161b0230fdd1faf9176f95fee76a7db6afd59 Mon Sep 17 00:00:00 2001 From: Zbigniew Jędrzejewski-Szmek Date: Thu, 11 Apr 2013 18:57:42 -0400 Subject: errno is positive Make sure we compare errno against positive error codes. The ones in hwclock.c and install.c can have an impact, the rest are unlikely to be hit or in code that isn't widely used. Also check that errno > 0, to help gcc know that we are returning a negative error code. --- src/systemctl/systemctl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/systemctl') diff --git a/src/systemctl/systemctl.c b/src/systemctl/systemctl.c index a950605503..1c7edd5a58 100644 --- a/src/systemctl/systemctl.c +++ b/src/systemctl/systemctl.c @@ -5260,7 +5260,7 @@ static int talk_initctl(void) { r = loop_write(fd, &request, sizeof(request), false) != sizeof(request); if (r) { log_error("Failed to write to "INIT_FIFO": %m"); - return errno ? -errno : -EIO; + return errno > 0 ? -errno : -EIO; } return 1; -- cgit v1.2.3-54-g00ecf