[polkit/f16] Add patch to neuter the annoying systemd behavior where stdout/stderr is sent to the system logs

David Zeuthen davidz at fedoraproject.org
Tue Oct 18 17:29:41 UTC 2011


commit 107fe94316c4c8170117d2dcb3ee6c4dde17516f
Author: David Zeuthen <davidz at redhat.com>
Date:   Tue Oct 18 13:29:14 2011 -0400

    Add patch to neuter the annoying systemd behavior where stdout/stderr
    is sent to the system logs
    
    Signed-off-by: David Zeuthen <davidz at redhat.com>

 polkit-0.102-neuter-stdout-and-stderr.patch |   77 +++++++++++++++++++++++++++
 polkit.spec                                 |    9 +++-
 2 files changed, 85 insertions(+), 1 deletions(-)
---
diff --git a/polkit-0.102-neuter-stdout-and-stderr.patch b/polkit-0.102-neuter-stdout-and-stderr.patch
new file mode 100644
index 0000000..afe2c7c
--- /dev/null
+++ b/polkit-0.102-neuter-stdout-and-stderr.patch
@@ -0,0 +1,77 @@
+From 3811e51b81320a574bb31aa64b6af56340012527 Mon Sep 17 00:00:00 2001
+From: David Zeuthen <davidz at redhat.com>
+Date: Tue, 18 Oct 2011 13:13:16 -0400
+Subject: [PATCH] Add --no-debug option and use this for D-Bus activation
+
+Signed-off-by: David Zeuthen <davidz at redhat.com>
+---
+ data/org.freedesktop.PolicyKit1.service.in |    2 +-
+ src/polkitd/main.c                         |   27 ++++++++++++++++++++++++++-
+ 2 files changed, 27 insertions(+), 2 deletions(-)
+
+diff --git a/data/org.freedesktop.PolicyKit1.service.in b/data/org.freedesktop.PolicyKit1.service.in
+index 5a54ca1..b6cd02b 100644
+--- a/data/org.freedesktop.PolicyKit1.service.in
++++ b/data/org.freedesktop.PolicyKit1.service.in
+@@ -1,4 +1,4 @@
+ [D-BUS Service]
+ Name=org.freedesktop.PolicyKit1
+-Exec=@libexecdir@/polkitd
++Exec=@libexecdir@/polkitd --no-debug
+ User=root
+diff --git a/src/polkitd/main.c b/src/polkitd/main.c
+index 33ea511..b21723f 100644
+--- a/src/polkitd/main.c
++++ b/src/polkitd/main.c
+@@ -22,6 +22,9 @@
+ #include "config.h"
+ 
+ #include <signal.h>
++
++#include <glib-unix.h>
++
+ #include <polkit/polkit.h>
+ #include <polkitbackend/polkitbackend.h>
+ 
+@@ -33,8 +36,10 @@ static PolkitBackendAuthority *authority = NULL;
+ static gpointer                registration_id = NULL;
+ static GMainLoop              *loop = NULL;
+ static gboolean                opt_replace = FALSE;
++static gboolean                opt_no_debug = FALSE;
+ static GOptionEntry            opt_entries[] = {
+-  {"replace", 0, 0, G_OPTION_ARG_NONE, &opt_replace, "Replace existing daemon", NULL},
++  {"replace", 'r', 0, G_OPTION_ARG_NONE, &opt_replace, "Replace existing daemon", NULL},
++  {"no-debug", 'n', 0, G_OPTION_ARG_NONE, &opt_no_debug, "Don't print debug information", NULL},
+   {NULL }
+ };
+ 
+@@ -120,6 +125,26 @@ main (int    argc,
+       goto out;
+     }
+ 
++  /* If --no-debug is requested don't clutter stdout/stderr etc.
++   */
++  if (opt_no_debug)
++    {
++      gint dev_null_fd;
++      dev_null_fd = open ("/dev/null", O_RDWR);
++      if (dev_null_fd >= 0)
++        {
++          dup2 (dev_null_fd, STDIN_FILENO);
++          dup2 (dev_null_fd, STDOUT_FILENO);
++          dup2 (dev_null_fd, STDERR_FILENO);
++          close (dev_null_fd);
++        }
++      else
++        {
++          g_warning ("Error opening /dev/null: %m");
++        }
++    }
++
++
+   loop = g_main_loop_new (NULL, FALSE);
+ 
+   sigint_id = _g_posix_signal_watch_add (SIGINT,
+-- 
+1.7.6.4
+
diff --git a/polkit.spec b/polkit.spec
index e365234..4568fcb 100644
--- a/polkit.spec
+++ b/polkit.spec
@@ -1,7 +1,7 @@
 Summary: PolicyKit Authorization Framework
 Name: polkit
 Version: 0.102
-Release: 1%{?dist}
+Release: 2%{?dist}
 License: LGPLv2+
 URL: http://www.freedesktop.org/wiki/Software/PolicyKit
 Source0: http://hal.freedesktop.org/releases/%{name}-%{version}.tar.gz
@@ -23,6 +23,8 @@ Provides: PolicyKit = 0.11
 # sufficiently new polkit-gnome package
 Conflicts: polkit-gnome < 0.97
 
+Patch0: polkit-0.102-neuter-stdout-and-stderr.patch
+
 %description
 PolicyKit is a toolkit for defining and handling authorizations.
 It is used for allowing unprivileged processes to speak to privileged
@@ -65,6 +67,7 @@ without being interrupted by password dialogs
 
 %prep
 %setup -q
+%patch0 -p1
 
 %build
 %configure --enable-gtk-doc \
@@ -172,6 +175,10 @@ EOF
 %{_datadir}/gtk-doc
 
 %changelog
+* Tue Oct 18 2011 David Zeuthen <davidz at redhat.com> 0.102-2%{?dist}
+- Add patch to neuter the annoying systemd behavior where stdout/stderr
+  is sent to the system logs
+
 * Fri Aug 04 2011 David Zeuthen <davidz at redhat.com> 0.102-1
 - Update to 0.102 release
 


More information about the scm-commits mailing list