mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-11-04 13:30:12 -05:00
protocol: improve error handling
This commit is contained in:
parent
216b641ebb
commit
c4f35825fe
2 changed files with 100 additions and 52 deletions
|
|
@ -62,13 +62,16 @@ int pw_protocol_native_connect_local_socket(struct pw_protocol_client *client,
|
|||
|
||||
if ((runtime_dir = getenv("XDG_RUNTIME_DIR")) == NULL) {
|
||||
pw_log_error("connect failed: XDG_RUNTIME_DIR not set in the environment");
|
||||
return -EIO;
|
||||
res = -EIO;
|
||||
goto error;
|
||||
}
|
||||
|
||||
name = get_remote(pw_remote_get_properties(remote));
|
||||
|
||||
if ((fd = socket(PF_LOCAL, SOCK_STREAM | SOCK_CLOEXEC | SOCK_NONBLOCK, 0)) < 0)
|
||||
return -errno;
|
||||
if ((fd = socket(PF_LOCAL, SOCK_STREAM | SOCK_CLOEXEC | SOCK_NONBLOCK, 0)) < 0) {
|
||||
res = -errno;
|
||||
goto error;
|
||||
}
|
||||
|
||||
memset(&addr, 0, sizeof(addr));
|
||||
addr.sun_family = AF_LOCAL;
|
||||
|
|
@ -94,7 +97,8 @@ int pw_protocol_native_connect_local_socket(struct pw_protocol_client *client,
|
|||
|
||||
return res;
|
||||
|
||||
error_close:
|
||||
close(fd);
|
||||
error_close:
|
||||
close(fd);
|
||||
error:
|
||||
return res;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue