Skip to content

Commit

Permalink
tools: hv: Improve error logging in VSS daemon.
Browse files Browse the repository at this point in the history
Use errno and strerror() when logging errors to provide more
information.

Signed-off-by: Tomas Hozza <[email protected]>
Signed-off-by: K. Y. Srinivasan <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
  • Loading branch information
thozza authored and gregkh committed Jul 26, 2013
1 parent 783c2fb commit 5c28926
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions tools/hv/hv_vss_daemon.c
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,8 @@ int main(void)

fd = socket(AF_NETLINK, SOCK_DGRAM, NETLINK_CONNECTOR);
if (fd < 0) {
syslog(LOG_ERR, "netlink socket creation failed; error:%d", fd);
syslog(LOG_ERR, "netlink socket creation failed; error:%d %s",
errno, strerror(errno));
exit(EXIT_FAILURE);
}
addr.nl_family = AF_NETLINK;
Expand All @@ -167,7 +168,7 @@ int main(void)

error = bind(fd, (struct sockaddr *)&addr, sizeof(addr));
if (error < 0) {
syslog(LOG_ERR, "bind failed; error:%d", error);
syslog(LOG_ERR, "bind failed; error:%d %s", errno, strerror(errno));
close(fd);
exit(EXIT_FAILURE);
}
Expand All @@ -187,7 +188,7 @@ int main(void)

len = netlink_send(fd, message);
if (len < 0) {
syslog(LOG_ERR, "netlink_send failed; error:%d", len);
syslog(LOG_ERR, "netlink_send failed; error:%d %s", errno, strerror(errno));
close(fd);
exit(EXIT_FAILURE);
}
Expand Down Expand Up @@ -241,7 +242,8 @@ int main(void)
vss_msg->error = error;
len = netlink_send(fd, incoming_cn_msg);
if (len < 0) {
syslog(LOG_ERR, "net_link send failed; error:%d", len);
syslog(LOG_ERR, "net_link send failed; error:%d %s",
errno, strerror(errno));
exit(EXIT_FAILURE);
}
}
Expand Down

0 comments on commit 5c28926

Please sign in to comment.