summaryrefslogtreecommitdiffstats
path: root/src/utils/pacmd.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/utils/pacmd.c')
-rw-r--r--src/utils/pacmd.c17
1 files changed, 11 insertions, 6 deletions
diff --git a/src/utils/pacmd.c b/src/utils/pacmd.c
index 16e5822f..67d95252 100644
--- a/src/utils/pacmd.c
+++ b/src/utils/pacmd.c
@@ -1,5 +1,3 @@
-/* $Id$ */
-
/***
This file is part of PulseAudio.
@@ -36,6 +34,7 @@
#include <pulse/error.h>
#include <pulse/util.h>
+#include <pulse/xmalloc.h>
#include <pulsecore/core-util.h>
#include <pulsecore/log.h>
@@ -49,8 +48,9 @@ int main(PA_GCC_UNUSED int argc, PA_GCC_UNUSED char*argv[]) {
char ibuf[256], obuf[256];
size_t ibuf_index, ibuf_length, obuf_index, obuf_length;
fd_set ifds, ofds;
+ char *cli;
- if (pa_pid_file_check_running(&pid) < 0) {
+ if (pa_pid_file_check_running(&pid, "pulseaudio") < 0) {
pa_log("no PulseAudio daemon running");
goto fail;
}
@@ -62,7 +62,12 @@ int main(PA_GCC_UNUSED int argc, PA_GCC_UNUSED char*argv[]) {
memset(&sa, 0, sizeof(sa));
sa.sun_family = AF_UNIX;
- pa_runtime_path("cli", sa.sun_path, sizeof(sa.sun_path));
+
+ if (!(cli = pa_runtime_path("cli")))
+ goto fail;
+
+ pa_strlcpy(sa.sun_path, cli, sizeof(sa.sun_path));
+ pa_xfree(cli);
for (i = 0; i < 5; i++) {
int r;
@@ -75,12 +80,12 @@ int main(PA_GCC_UNUSED int argc, PA_GCC_UNUSED char*argv[]) {
if (r >= 0)
break;
- if (pa_pid_file_kill(SIGUSR2, NULL) < 0) {
+ if (pa_pid_file_kill(SIGUSR2, NULL, "pulseaudio") < 0) {
pa_log("failed to kill PulseAudio daemon.");
goto fail;
}
- pa_msleep(50);
+ pa_msleep(300);
}
if (i >= 5) {