]> code.delx.au - pulseaudio/blobdiff - src/pulsecore/pid.c
Remove unnecessary #includes
[pulseaudio] / src / pulsecore / pid.c
index 008784629de97b899580773aaf42af3568276f93..50968deace70d664ed62e1ed6c975bf13f052ef6 100644 (file)
@@ -40,7 +40,6 @@
 #endif
 
 #include <pulse/xmalloc.h>
-#include <pulse/util.h>
 
 #include <pulsecore/core-error.h>
 #include <pulsecore/core-util.h>
@@ -81,17 +80,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 +119,6 @@ static int open_pid_file(const char *fn, int mode) {
             fd = -1;
             goto fail;
         }
-
-        fd = -1;
     }
 
     return fd;
@@ -148,7 +142,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 {
@@ -223,7 +217,7 @@ int pa_pid_file_create(const char *procname) {
             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;
                 }