]> git.ipfire.org Git - thirdparty/cups.git/commitdiff
The web interface did not work on OpenBSD (STR #4496)
authormsweet <msweet@a1ca3aef-8c08-0410-bb20-df032aa958be>
Fri, 14 Nov 2014 17:14:30 +0000 (17:14 +0000)
committermsweet <msweet@a1ca3aef-8c08-0410-bb20-df032aa958be>
Fri, 14 Nov 2014 17:14:30 +0000 (17:14 +0000)
posix_spawnattr_setsigdefault and POSIX_SPAWN_SETSIGDEF are busted on OpenBSD.

git-svn-id: svn+ssh://src.apple.com/svn/cups/cups.org/trunk@12251 a1ca3aef-8c08-0410-bb20-df032aa958be

CHANGES-2.0.txt
scheduler/process.c

index fc8ad87c30f7c206d6dd680d8a6ed3ad8f4a5c97..e00e1233c87aba9ddb6e14c836ff6be00ca42995 100644 (file)
@@ -26,6 +26,7 @@ CHANGES IN CUPS V2.0.1
        - Added a USB quirk rule for the Brother HL-1250 (STR #4519)
        - Fixed compiles on unsupported platforms (STR #4510)
        - "cancel -a" did not cancel all jobs on all destinations (STR #4513)
+       - The web interface did not work on OpenBSD (STR #4496)
 
 
 CHANGES IN CUPS V2.0.0
index 62f9b862aaeba9a6f83739ee6229927df9f3ad62..e4d897c296c1a0db4cdb820f5cc613f852e20985 100644 (file)
@@ -465,12 +465,13 @@ cupsdStartProcess(
                nice_str[16];           /* FilterNice string */
   uid_t                user;                   /* Command UID */
   cupsd_proc_t *proc;                  /* New process record */
-#ifdef HAVE_POSIX_SPAWN
+#if defined(HAVE_POSIX_SPAWN) && !defined(__OpenBSD__)
   posix_spawn_file_actions_t actions;  /* Spawn file actions */
   posix_spawnattr_t attrs;             /* Spawn attributes */
+  sigset_t     defsignals;             /* Default signals */
 #elif defined(HAVE_SIGACTION) && !defined(HAVE_SIGSET)
   struct sigaction action;             /* POSIX signal handler */
-#endif /* HAVE_POSIX_SPAWN */
+#endif /* HAVE_POSIX_SPAWN && !__OpenBSD__ */
 #if defined(__APPLE__)
   char         processPath[1024],      /* CFProcessPath environment variable */
                linkpath[1024];         /* Link path for symlinks... */
@@ -534,9 +535,9 @@ cupsdStartProcess(
   * Use helper program when we have a sandbox profile...
   */
 
-#ifndef HAVE_POSIX_SPAWN
+#if !defined(HAVE_POSIX_SPAWN) || defined(__OpenBSD__)
   if (profile)
-#endif /* !HAVE_POSIX_SPAWN */
+#endif /* !HAVE_POSIX_SPAWN || __OpenBSD__ */
   {
     snprintf(cups_exec, sizeof(cups_exec), "%s/daemon/cups-exec", ServerBin);
     snprintf(user_str, sizeof(user_str), "%d", user);
@@ -572,14 +573,21 @@ cupsdStartProcess(
       cupsdLogMessage(CUPSD_LOG_DEBUG2, "cupsdStartProcess: argv[%d] = \"%s\"", i, argv[i]);
   }
 
-#ifdef HAVE_POSIX_SPAWN
+#if defined(HAVE_POSIX_SPAWN) && !defined(__OpenBSD__) /* OpenBSD posix_spawn is busted with SETSIGDEF */
  /*
   * Setup attributes and file actions for the spawn...
   */
 
   cupsdLogMessage(CUPSD_LOG_DEBUG2, "cupsdStartProcess: Setting spawn attributes.");
+  sigemptyset(&defsignals);
+  sigaddset(&defsignals, SIGTERM);
+  sigaddset(&defsignals, SIGCHLD);
+  sigaddset(&defsignals, SIGPIPE);
+
   posix_spawnattr_init(&attrs);
   posix_spawnattr_setflags(&attrs, POSIX_SPAWN_SETPGROUP | POSIX_SPAWN_SETSIGDEF);
+  posix_spawnattr_setpgroup(&attrs, 0);
+  posix_spawnattr_setsigdefault(&attrs, &defsignals);
 
   cupsdLogMessage(CUPSD_LOG_DEBUG2, "cupsdStartProcess: Setting file actions.");
   posix_spawn_file_actions_init(&actions);
@@ -788,7 +796,7 @@ cupsdStartProcess(
   }
 
   cupsdReleaseSignals();
-#endif /* HAVE_POSIX_SPAWN */
+#endif /* HAVE_POSIX_SPAWN && !__OpenBSD__ */
 
   if (*pid)
   {