bhyvectl: do not return garbage from send_message
err is used uninitialized in some cases. Reviewed by: corvink, markj MFC after: 1 week Sponsored by: vStack Differential Revision: https://reviews.freebsd.org/D38886
This commit is contained in:
parent
ee10c61d7a
commit
89fe7b98fe
@ -1679,12 +1679,12 @@ static int
|
||||
send_message(const char *vmname, nvlist_t *nvl)
|
||||
{
|
||||
struct sockaddr_un addr;
|
||||
int err, socket_fd;
|
||||
int err = 0, socket_fd;
|
||||
|
||||
socket_fd = socket(PF_UNIX, SOCK_STREAM, 0);
|
||||
if (socket_fd < 0) {
|
||||
perror("Error creating bhyvectl socket");
|
||||
err = -1;
|
||||
err = errno;
|
||||
goto done;
|
||||
}
|
||||
|
||||
@ -1700,8 +1700,10 @@ send_message(const char *vmname, nvlist_t *nvl)
|
||||
goto done;
|
||||
}
|
||||
|
||||
if (nvlist_send(socket_fd, nvl) < 0)
|
||||
if (nvlist_send(socket_fd, nvl) < 0) {
|
||||
perror("nvlist_send() failed");
|
||||
err = errno;
|
||||
}
|
||||
nvlist_destroy(nvl);
|
||||
|
||||
done:
|
||||
|
Loading…
Reference in New Issue
Block a user