Commit 395d3bfc authored by Juergen Lock's avatar Juergen Lock Committed by Rémi Denis-Courmont

PulseAudio: fix segmentation fault

Reported by: Rainer Hurling
Signed-off-by: default avatarRémi Denis-Courmont <remi@remlab.net>
(cherry picked from commit 7751dc1fb827256b226fe49bd99fe6a5f37f5c8a)
parent 8e8b02ff
...@@ -113,10 +113,13 @@ pa_context *vlc_pa_connect (vlc_object_t *obj, pa_threaded_mainloop **mlp) ...@@ -113,10 +113,13 @@ pa_context *vlc_pa_connect (vlc_object_t *obj, pa_threaded_mainloop **mlp)
struct passwd pwbuf, *pw; struct passwd pwbuf, *pw;
char buf[len]; char buf[len];
if (getpwuid_r (getuid (), &pwbuf, buf, sizeof (buf), &pw) == 0 if (getpwuid_r (getuid (), &pwbuf, buf, sizeof (buf), &pw) == 0)
&& pw != NULL) {
pa_proplist_sets (props, PA_PROP_APPLICATION_PROCESS_USER, if (pw != NULL)
pw->pw_name); pa_proplist_sets (props, PA_PROP_APPLICATION_PROCESS_USER,
pw->pw_name);
break;
}
} }
for (size_t max = sysconf (_SC_HOST_NAME_MAX), len = max % 1024 + 1024; for (size_t max = sysconf (_SC_HOST_NAME_MAX), len = max % 1024 + 1024;
...@@ -125,8 +128,11 @@ pa_context *vlc_pa_connect (vlc_object_t *obj, pa_threaded_mainloop **mlp) ...@@ -125,8 +128,11 @@ pa_context *vlc_pa_connect (vlc_object_t *obj, pa_threaded_mainloop **mlp)
char hostname[len]; char hostname[len];
if (gethostname (hostname, sizeof (hostname)) == 0) if (gethostname (hostname, sizeof (hostname)) == 0)
{
pa_proplist_sets (props, PA_PROP_APPLICATION_PROCESS_HOST, pa_proplist_sets (props, PA_PROP_APPLICATION_PROCESS_HOST,
hostname); hostname);
break;
}
} }
const char *session = getenv ("XDG_SESSION_COOKIE"); const char *session = getenv ("XDG_SESSION_COOKIE");
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment