ports/audio/pulseaudio/patches/patch-src_pulse_util_c

48 lines
978 B
Text

Implement pa_get_binary_name().
Index: src/pulse/util.c
--- src/pulse/util.c.orig
+++ src/pulse/util.c
@@ -52,6 +52,11 @@
#include <sys/sysctl.h>
#endif
+#ifdef __OpenBSD__
+#include <libgen.h>
+#include <sys/sysctl.h>
+#endif
+
#include <pulse/xmalloc.h>
#include <pulse/timeval.h>
@@ -253,6 +258,30 @@ char *pa_get_binary_name(char *s, size_t l) {
}
}
#endif
+
+#ifdef __OpenBSD__
+ {
+ size_t len;
+ char **buf;
+
+ int mib[] = { CTL_KERN, KERN_PROC_ARGS, getpid(), KERN_PROC_ARGV };
+
+ if (sysctl (mib, 4, NULL, &len, NULL, 0) == -1)
+ return NULL;
+
+ buf = (char *) pa_xmalloc(len);
+
+ if (sysctl(mib, 4, buf, &len, NULL, 0) == 0) {
+ pa_strlcpy(s, basename(*buf), l);
+ pa_xfree(buf);
+ return s;
+ }
+
+ pa_xfree(buf);
+
+ /* fall thru */
+ }
+#endif /* __OpenBSD__ */
#if defined(HAVE_DLADDR) && defined(PA_GCC_WEAKREF)
{