PulseAudio is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2 of the
+ published by the Free Software Foundation; either version 2.1 of the
License, or (at your option) any later version.
PulseAudio is distributed in the hope that it will be useful, but
#endif
#include <pulse/xmalloc.h>
-#include <pulse/util.h>
#include <pulsecore/core-error.h>
#include <pulsecore/core-util.h>
}
static int open_pid_file(const char *fn, int mode) {
- int fd = -1;
+ int fd;
pa_assert(fn);
for (;;) {
struct stat st;
- if ((fd = open(fn, mode
-#ifdef O_NOCTTY
- |O_NOCTTY
-#endif
+ if ((fd = pa_open_cloexec(fn, mode
#ifdef O_NOFOLLOW
|O_NOFOLLOW
#endif
fd = -1;
goto fail;
}
-
- fd = -1;
}
return fd;
pa_snprintf(bn, sizeof(bn), "/proc/%lu/stat", (unsigned long) pid);
- if (!(f = fopen(bn, "r"))) {
+ if (!(f = pa_fopen_cloexec(bn, "r"))) {
pa_log_info("Failed to open %s: %s", bn, pa_cstrerror(errno));
return -1;
} else {
if (procname)
if ((ours = proc_name_ours(pid, procname)) < 0) {
pa_log_warn("Could not check to see if pid %lu is a pulseaudio process. "
- "Asssuming it is and the daemon is already running.", (unsigned long) pid);
+ "Assuming it is and the daemon is already running.", (unsigned long) pid);
goto fail;
}