mirror of
https://gitlab.freedesktop.org/pulseaudio/pulseaudio.git
synced 2025-11-04 13:29:59 -05:00
AF_UNIX and PF_UNIX is more portable than the _LOCAL equivalent.
git-svn-id: file:///home/lennart/svn/public/pulseaudio/branches/ossman@376 fefdeb5f-60dc-0310-8127-8f9354f1896f
This commit is contained in:
parent
dbad54a20b
commit
3a3b4aff37
3 changed files with 6 additions and 6 deletions
|
|
@ -203,7 +203,7 @@ struct pa_socket_client* pa_socket_client_new_unix(struct pa_mainloop_api *m, co
|
||||||
assert(m && filename);
|
assert(m && filename);
|
||||||
|
|
||||||
memset(&sa, 0, sizeof(sa));
|
memset(&sa, 0, sizeof(sa));
|
||||||
sa.sun_family = AF_LOCAL;
|
sa.sun_family = AF_UNIX;
|
||||||
strncpy(sa.sun_path, filename, sizeof(sa.sun_path)-1);
|
strncpy(sa.sun_path, filename, sizeof(sa.sun_path)-1);
|
||||||
sa.sun_path[sizeof(sa.sun_path) - 1] = 0;
|
sa.sun_path[sizeof(sa.sun_path) - 1] = 0;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -144,14 +144,14 @@ struct pa_socket_server* pa_socket_server_new_unix(struct pa_mainloop_api *m, co
|
||||||
|
|
||||||
assert(m && filename);
|
assert(m && filename);
|
||||||
|
|
||||||
if ((fd = socket(PF_LOCAL, SOCK_STREAM, 0)) < 0) {
|
if ((fd = socket(PF_UNIX, SOCK_STREAM, 0)) < 0) {
|
||||||
pa_log(__FILE__": socket(): %s\n", strerror(errno));
|
pa_log(__FILE__": socket(): %s\n", strerror(errno));
|
||||||
goto fail;
|
goto fail;
|
||||||
}
|
}
|
||||||
|
|
||||||
pa_fd_set_cloexec(fd, 1);
|
pa_fd_set_cloexec(fd, 1);
|
||||||
|
|
||||||
sa.sun_family = AF_LOCAL;
|
sa.sun_family = AF_UNIX;
|
||||||
strncpy(sa.sun_path, filename, sizeof(sa.sun_path)-1);
|
strncpy(sa.sun_path, filename, sizeof(sa.sun_path)-1);
|
||||||
sa.sun_path[sizeof(sa.sun_path) - 1] = 0;
|
sa.sun_path[sizeof(sa.sun_path) - 1] = 0;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -77,7 +77,7 @@ void pa_socket_peer_to_string(int fd, char *c, size_t l) {
|
||||||
ip & 0xFF,
|
ip & 0xFF,
|
||||||
ntohs(sa.in.sin_port));
|
ntohs(sa.in.sin_port));
|
||||||
return;
|
return;
|
||||||
} else if (sa.sa.sa_family == AF_LOCAL) {
|
} else if (sa.sa.sa_family == AF_UNIX) {
|
||||||
snprintf(c, l, "UNIX socket client");
|
snprintf(c, l, "UNIX socket client");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
@ -165,12 +165,12 @@ int pa_unix_socket_is_stale(const char *fn) {
|
||||||
struct sockaddr_un sa;
|
struct sockaddr_un sa;
|
||||||
int fd = -1, ret = -1;
|
int fd = -1, ret = -1;
|
||||||
|
|
||||||
if ((fd = socket(PF_LOCAL, SOCK_STREAM, 0)) < 0) {
|
if ((fd = socket(PF_UNIX, SOCK_STREAM, 0)) < 0) {
|
||||||
pa_log(__FILE__": socket(): %s\n", strerror(errno));
|
pa_log(__FILE__": socket(): %s\n", strerror(errno));
|
||||||
goto finish;
|
goto finish;
|
||||||
}
|
}
|
||||||
|
|
||||||
sa.sun_family = AF_LOCAL;
|
sa.sun_family = AF_UNIX;
|
||||||
strncpy(sa.sun_path, fn, sizeof(sa.sun_path)-1);
|
strncpy(sa.sun_path, fn, sizeof(sa.sun_path)-1);
|
||||||
sa.sun_path[sizeof(sa.sun_path) - 1] = 0;
|
sa.sun_path[sizeof(sa.sun_path) - 1] = 0;
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue