mirror of
https://gitlab.freedesktop.org/pulseaudio/pulseaudio.git
synced 2025-11-04 13:29:59 -05:00
Fix so that peer name can be determined on Windows. We do not support console
on Windows at this time so we do not have to worry about that right now. git-svn-id: file:///home/lennart/svn/public/pulseaudio/trunk@459 fefdeb5f-60dc-0310-8127-8f9354f1896f
This commit is contained in:
parent
60dbf8b82d
commit
30bb5ceaee
1 changed files with 8 additions and 0 deletions
|
|
@ -69,17 +69,22 @@ void pa_socket_peer_to_string(int fd, char *c, size_t l) {
|
|||
|
||||
assert(c && l && fd >= 0);
|
||||
|
||||
#ifndef OS_IS_WIN32
|
||||
if (fstat(fd, &st) < 0) {
|
||||
snprintf(c, l, "Invalid client fd");
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifndef OS_IS_WIN32
|
||||
if (S_ISSOCK(st.st_mode)) {
|
||||
#endif
|
||||
union {
|
||||
struct sockaddr sa;
|
||||
struct sockaddr_in in;
|
||||
#ifdef HAVE_SYS_UN_H
|
||||
struct sockaddr_un un;
|
||||
#endif
|
||||
} sa;
|
||||
socklen_t sa_len = sizeof(sa);
|
||||
|
||||
|
|
@ -95,12 +100,15 @@ void pa_socket_peer_to_string(int fd, char *c, size_t l) {
|
|||
ip & 0xFF,
|
||||
ntohs(sa.in.sin_port));
|
||||
return;
|
||||
#ifdef HAVE_SYS_UN_H
|
||||
} else if (sa.sa.sa_family == AF_UNIX) {
|
||||
snprintf(c, l, "UNIX socket client");
|
||||
return;
|
||||
#endif
|
||||
}
|
||||
|
||||
}
|
||||
#ifndef OS_IS_WIN32
|
||||
snprintf(c, l, "Unknown network client");
|
||||
return;
|
||||
} else if (S_ISCHR(st.st_mode) && (fd == 0 || fd == 1)) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue