virtio-9p-proxy: improve error messages in connect_namedsocket()

Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
Reviewed-by: Gonglei <arei.gonglei@huawei.com>
This commit is contained in:
Michael Tokarev 2014-10-30 11:05:13 +03:00
parent 6af76c6f7d
commit 7d5a8435ba
1 changed files with 2 additions and 2 deletions

View File

@ -1104,14 +1104,14 @@ static int connect_namedsocket(const char *path)
sockfd = socket(AF_UNIX, SOCK_STREAM, 0);
if (sockfd < 0) {
fprintf(stderr, "socket %s\n", strerror(errno));
fprintf(stderr, "failed to create socket: %s\n", strerror(errno));
return -1;
}
strcpy(helper.sun_path, path);
helper.sun_family = AF_UNIX;
size = strlen(helper.sun_path) + sizeof(helper.sun_family);
if (connect(sockfd, (struct sockaddr *)&helper, size) < 0) {
fprintf(stderr, "socket error\n");
fprintf(stderr, "failed to connect to %s: %s\n", path, strerror(errno));
close(sockfd);
return -1;
}