From: msweet Date: Fri, 14 Nov 2014 17:14:30 +0000 (+0000) Subject: The web interface did not work on OpenBSD (STR #4496) X-Git-Tag: v2.2b1~441 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=73174bb3ba1c5f66cbf60c3796ffdc93f0efd336;p=thirdparty%2Fcups.git The web interface did not work on OpenBSD (STR #4496) 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 --- diff --git a/CHANGES-2.0.txt b/CHANGES-2.0.txt index fc8ad87c30..e00e1233c8 100644 --- a/CHANGES-2.0.txt +++ b/CHANGES-2.0.txt @@ -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 diff --git a/scheduler/process.c b/scheduler/process.c index 62f9b862aa..e4d897c296 100644 --- a/scheduler/process.c +++ b/scheduler/process.c @@ -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) {