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:
parent
6af76c6f7d
commit
7d5a8435ba
@ -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;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user