Commit 54d3eed0 authored by Ben Hutchings's avatar Ben Hutchings

tools/hv: Fix exit() error code

commit 6bb22fea upstream.

Linux native exit codes are 8-bit unsigned values.  exit(-1) results
in an exit code of 255, which is usually reserved for shells reporting
'command not found'.  Use the portable value EXIT_FAILURE.  (Not that
this matters much for a daemon.)
Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
Signed-off-by: default avatarK. Y. Srinivasan <kys@microsoft.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
[bwh: Backported to 3.2: drop changes to exit() calls not in this version]
parent 77ad5624
...@@ -348,7 +348,7 @@ int main(void) ...@@ -348,7 +348,7 @@ int main(void)
fd = socket(AF_NETLINK, SOCK_DGRAM, NETLINK_CONNECTOR); fd = socket(AF_NETLINK, SOCK_DGRAM, NETLINK_CONNECTOR);
if (fd < 0) { if (fd < 0) {
syslog(LOG_ERR, "netlink socket creation failed; error:%d", fd); syslog(LOG_ERR, "netlink socket creation failed; error:%d", fd);
exit(-1); exit(EXIT_FAILURE);
} }
addr.nl_family = AF_NETLINK; addr.nl_family = AF_NETLINK;
addr.nl_pad = 0; addr.nl_pad = 0;
...@@ -360,7 +360,7 @@ int main(void) ...@@ -360,7 +360,7 @@ int main(void)
if (error < 0) { if (error < 0) {
syslog(LOG_ERR, "bind failed; error:%d", error); syslog(LOG_ERR, "bind failed; error:%d", error);
close(fd); close(fd);
exit(-1); exit(EXIT_FAILURE);
} }
sock_opt = addr.nl_groups; sock_opt = addr.nl_groups;
setsockopt(fd, 270, 1, &sock_opt, sizeof(sock_opt)); setsockopt(fd, 270, 1, &sock_opt, sizeof(sock_opt));
...@@ -378,7 +378,7 @@ int main(void) ...@@ -378,7 +378,7 @@ int main(void)
if (len < 0) { if (len < 0) {
syslog(LOG_ERR, "netlink_send failed; error:%d", len); syslog(LOG_ERR, "netlink_send failed; error:%d", len);
close(fd); close(fd);
exit(-1); exit(EXIT_FAILURE);
} }
pfd.fd = fd; pfd.fd = fd;
...@@ -497,7 +497,7 @@ int main(void) ...@@ -497,7 +497,7 @@ int main(void)
len = netlink_send(fd, incoming_cn_msg); len = netlink_send(fd, incoming_cn_msg);
if (len < 0) { if (len < 0) {
syslog(LOG_ERR, "net_link send failed; error:%d", len); syslog(LOG_ERR, "net_link send failed; error:%d", len);
exit(-1); exit(EXIT_FAILURE);
} }
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment