]> code.delx.au - pulseaudio/blobdiff - src/pulsecore/pid.c
core: Fix macro typo - PA_SINK_IS_LINKED -> PA_SINK_INPUT_IS_LINKED
[pulseaudio] / src / pulsecore / pid.c
index 008784629de97b899580773aaf42af3568276f93..213e798383d05cd90ea44ca604c5975afa653ed0 100644 (file)
@@ -81,17 +81,14 @@ static pid_t read_pid(const char *fn, int fd) {
 }
 
 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
@@ -123,8 +120,6 @@ static int open_pid_file(const char *fn, int mode) {
             fd = -1;
             goto fail;
         }
-
-        fd = -1;
     }
 
     return fd;
@@ -148,7 +143,7 @@ static int proc_name_ours(pid_t pid, const char *procname) {
 
     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 {