summaryrefslogtreecommitdiffstats
path: root/src/pulsecore/core-util.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/pulsecore/core-util.c')
-rw-r--r--src/pulsecore/core-util.c18
1 files changed, 15 insertions, 3 deletions
diff --git a/src/pulsecore/core-util.c b/src/pulsecore/core-util.c
index 56253391..24d929d7 100644
--- a/src/pulsecore/core-util.c
+++ b/src/pulsecore/core-util.c
@@ -2462,7 +2462,7 @@ char *pa_machine_id(void) {
pa_strip_nl(ln);
if (r && ln[0])
- return pa_xstrdup(ln);
+ return pa_utf8_filter(ln);
}
/* The we fall back to the host name. It supposed to be somewhat
@@ -2480,13 +2480,16 @@ char *pa_machine_id(void) {
break;
} else if (strlen(c) < l-1) {
+ char *u;
if (*c == 0) {
pa_xfree(c);
break;
}
- return c;
+ u = pa_utf8_filter(c);
+ pa_xfree(c);
+ return u;
}
/* Hmm, the hostname is as long the space we offered the
@@ -2498,10 +2501,19 @@ char *pa_machine_id(void) {
}
/* If no hostname was set we use the POSIX hostid. It's usually
- * the IPv4 address. Mit not be that stable. */
+ * the IPv4 address. Might not be that stable. */
return pa_sprintf_malloc("%08lx", (unsigned long) gethostid);
}
+char *pa_session_id(void) {
+ const char *e;
+
+ if (!(e = getenv("XDG_SESSION_COOKIE")))
+ return NULL;
+
+ return pa_utf8_filter(e);
+}
+
char *pa_uname_string(void) {
struct utsname u;