$OpenBSD: patch-modules_misc_inhibit_xdg_c,v 1.2 2011/12/23 15:01:59 sthen Exp $

Missing posix_spawnp and family.

--- modules/misc/inhibit/xdg.c.orig	Tue Nov 22 15:30:36 2011
+++ modules/misc/inhibit/xdg.c	Wed Dec 21 09:22:40 2011
@@ -27,7 +27,6 @@
 #include <vlc_inhibit.h>
 #include <assert.h>
 #include <signal.h>
-#include <spawn.h>
 #include <sys/wait.h>
 
 static int Open (vlc_object_t *);
@@ -47,7 +46,6 @@ struct vlc_inhibit_sys
     vlc_thread_t thread;
     vlc_cond_t update, inactive;
     vlc_mutex_t lock;
-    posix_spawnattr_t attr;
     bool suspend, suspended;
 };
 
@@ -67,18 +65,6 @@ static int Open (vlc_object_t *obj)
     vlc_mutex_init (&p_sys->lock);
     vlc_cond_init (&p_sys->update);
     vlc_cond_init (&p_sys->inactive);
-    posix_spawnattr_init (&p_sys->attr);
-    /* Reset signal handlers to default and clear mask in the child process */
-    {
-        sigset_t set;
-
-        sigemptyset (&set);
-        posix_spawnattr_setsigmask (&p_sys->attr, &set);
-        sigaddset (&set, SIGPIPE);
-        posix_spawnattr_setsigdefault (&p_sys->attr, &set);
-        posix_spawnattr_setflags (&p_sys->attr, POSIX_SPAWN_SETSIGDEF
-                                              | POSIX_SPAWN_SETSIGMASK);
-    }
     p_sys->suspend = false;
     p_sys->suspended = false;
 
@@ -106,7 +92,6 @@ static void Close (vlc_object_t *obj)
 
     vlc_cancel (p_sys->thread);
     vlc_join (p_sys->thread, NULL);
-    posix_spawnattr_destroy (&p_sys->attr);
     vlc_cond_destroy (&p_sys->inactive);
     vlc_cond_destroy (&p_sys->update);
     vlc_mutex_destroy (&p_sys->lock);
@@ -143,26 +128,10 @@ static void *Thread (void *data)
             vlc_cond_wait (&p_sys->update, &p_sys->lock);
 
         int canc = vlc_savecancel ();
-        char *argv[4] = {
-            (char *)"xdg-screensaver",
-            (char *)(p_sys->suspend ? "suspend" : "resume"),
-            id,
-            NULL,
-        };
-        pid_t pid;
 
         vlc_mutex_unlock (&p_sys->lock);
-        if (!posix_spawnp (&pid, "xdg-screensaver", NULL, &p_sys->attr,
-                           argv, environ))
-        {
-            int status;
 
-            msg_Dbg (ih, "started xdg-screensaver (PID = %d)", (int)pid);
-            /* Wait for command to complete */
-            while (waitpid (pid, &status, 0) == -1);
-        }
-        else/* We don't handle the error, but busy looping would be worse :( */
-            msg_Warn (ih, "could not start xdg-screensaver");
+        msg_Warn (ih, "could not start xdg-screensaver");
 
         vlc_mutex_lock (&p_sys->lock);
         p_sys->suspended = p_sys->suspend;
