Bring some fixes from upstream:

* sync configure.ac patch
* dbus-spawn: set SIGPIPE to SIG_IGN before activating services
* dbus-sysdeps-pthread.c: don't fail if !HAVE_MONOTONIC_CLOCK under -Werror=unused
* Remove redundant close() calls
* Don't leak temporary fds pointing to /dev/null
This commit is contained in:
ajacoutot 2013-01-08 09:30:27 +00:00
parent 2ab1ba5e01
commit 978381c7b1
7 changed files with 119 additions and 19 deletions

View File

@ -1,4 +1,4 @@
# $OpenBSD: Makefile,v 1.95 2013/01/01 14:36:11 ajacoutot Exp $
# $OpenBSD: Makefile,v 1.96 2013/01/08 09:30:27 ajacoutot Exp $
# DPB: not parallel-safe
@ -6,7 +6,7 @@ COMMENT= message bus system
DISTNAME= dbus-1.6.8
EPOCH= 0
REVISION= 4
REVISION= 5
SHARED_LIBS += dbus-1 10.2 # 10.2

View File

@ -1,9 +1,12 @@
$OpenBSD: patch-configure_ac,v 1.2 2012/09/30 07:51:33 ajacoutot Exp $
$OpenBSD: patch-configure_ac,v 1.3 2013/01/08 09:30:27 ajacoutot Exp $
https://bugs.freedesktop.org/show_bug.cgi?id=47239
From 277675a40e7252a1c5c479b0e0572d9b8a4014ae Mon Sep 17 00:00:00 2001
From: Simon McVittie <simon.mcvittie@collabora.co.uk>
Date: Mon, 13 Aug 2012 18:43:12 +0000
Subject: configure: redo pthread check to check for more things
--- configure.ac.orig Fri Sep 28 21:41:40 2012
+++ configure.ac Sun Sep 30 09:42:04 2012
+++ configure.ac Tue Jan 8 09:54:30 2013
@@ -953,15 +953,53 @@ AC_SUBST([XML_CFLAGS])
AC_SUBST([XML_LIBS])
@ -65,7 +68,7 @@ https://bugs.freedesktop.org/show_bug.cgi?id=47239
#include <pthread.h>
]], [[
struct timespec monotonic_timer;
@@ -970,15 +1008,18 @@ pthread_condattr_init (&attr);
@@ -970,15 +1008,17 @@ pthread_condattr_init (&attr);
pthread_condattr_setclock (&attr, CLOCK_MONOTONIC);
clock_getres (CLOCK_MONOTONIC,&monotonic_timer);
]])],
@ -78,7 +81,6 @@ https://bugs.freedesktop.org/show_bug.cgi?id=47239
- AC_MSG_RESULT([not found])
-fi
-fi
+
+ [have_clock_monotonic=true],
+ [have_clock_monotonic=false])
+ AS_IF([test x$have_clock_monotonic = xtrue],

View File

@ -0,0 +1,22 @@
$OpenBSD: patch-dbus_dbus-spawn_c,v 1.1 2013/01/08 09:30:27 ajacoutot Exp $
From 90f939f155bd120f44ff3906296707a6c00cd462 Mon Sep 17 00:00:00 2001
From: Ray Strode <rstrode@redhat.com>
Date: Tue, 16 Oct 2012 18:38:28 +0000
Subject: dbus-spawn: set SIGPIPE to SIG_IGN before activating services
--- dbus/dbus-spawn.c.orig Fri Sep 28 21:17:25 2012
+++ dbus/dbus-spawn.c Tue Jan 8 10:00:23 2013
@@ -1256,7 +1256,11 @@ _dbus_spawn_async_with_babysitter (DBusBabysitter
_dbus_assert_not_reached ("Got to code after write_err_and_exit()");
}
else if (grandchild_pid == 0)
- {
+ {
+ /* Go back to ignoring SIGPIPE, since it's evil
+ */
+ signal (SIGPIPE, SIG_IGN);
+
do_exec (child_err_report_pipe[WRITE_END],
argv,
env,

View File

@ -0,0 +1,24 @@
$OpenBSD: patch-dbus_dbus-sysdeps-pthread_c,v 1.1 2013/01/08 09:30:27 ajacoutot Exp $
From 0b7ab6cf1cf54080f9cd4851a7b7f4b247af7d99 Mon Sep 17 00:00:00 2001
From: Simon McVittie <simon.mcvittie@collabora.co.uk>
Date: Mon, 13 Aug 2012 18:43:56 +0000
Subject: dbus-sysdeps-pthread.c: don't fail if !HAVE_MONOTONIC_CLOCK under -Werror=unused
--- dbus/dbus-sysdeps-pthread.c.orig Fri Sep 28 21:17:25 2012
+++ dbus/dbus-sysdeps-pthread.c Tue Jan 8 09:56:41 2013
@@ -36,12 +36,14 @@
#include <config.h>
+#ifdef HAVE_MONOTONIC_CLOCK
/* Whether we have a "monotonic" clock; i.e. a clock not affected by
* changes in system time.
* This is initialized once in check_monotonic_clock below.
* https://bugs.freedesktop.org/show_bug.cgi?id=18121
*/
static dbus_bool_t have_monotonic_clock = 0;
+#endif
struct DBusRMutex {
pthread_mutex_t lock; /**< the lock */

View File

@ -1,11 +1,16 @@
$OpenBSD: patch-dbus_dbus-sysdeps-unix_c,v 1.11 2012/10/10 17:20:36 ajacoutot Exp $
$OpenBSD: patch-dbus_dbus-sysdeps-unix_c,v 1.12 2013/01/08 09:30:27 ajacoutot Exp $
From pkgsrc:
_dbus_poll: set the timeout value argument to poll to -1 whenever it is
less than -1 to avoid an infinite EINVAL loop.
From b8b3feb98646c8294c86f8391d243aaf3f8ac684 Mon Sep 17 00:00:00 2001
From: Michel HERMIER <hermier@frugalware.org>
Date: Fri, 09 Nov 2012 15:53:46 +0000
Subject: Remove redundant close() calls
--- dbus/dbus-sysdeps-unix.c.orig Fri Sep 28 21:31:47 2012
+++ dbus/dbus-sysdeps-unix.c Wed Oct 10 17:53:43 2012
+++ dbus/dbus-sysdeps-unix.c Tue Jan 8 09:55:49 2013
@@ -2525,6 +2525,10 @@ _dbus_poll (DBusPollFD *fds,
_DBUS_STRUCT_OFFSET (DBusPollFD, revents) ==
_DBUS_STRUCT_OFFSET (struct pollfd, revents))
@ -17,3 +22,22 @@ less than -1 to avoid an infinite EINVAL loop.
return poll ((struct pollfd*) fds,
n_fds,
timeout_milliseconds);
@@ -3299,15 +3303,12 @@ _read_subprocess_line_argv (const char *progpath,
/* set-up stdXXX */
close (result_pipe[READ_END]);
close (errors_pipe[READ_END]);
- close (0); /* close stdin */
- close (1); /* close stdout */
- close (2); /* close stderr */
- if (dup2 (fd, 0) == -1)
+ if (dup2 (fd, 0) == -1) /* setup stdin */
_exit (1);
- if (dup2 (result_pipe[WRITE_END], 1) == -1)
+ if (dup2 (result_pipe[WRITE_END], 1) == -1) /* setup stdout */
_exit (1);
- if (dup2 (errors_pipe[WRITE_END], 2) == -1)
+ if (dup2 (errors_pipe[WRITE_END], 2) == -1) /* setup stderr */
_exit (1);
_dbus_close_all ();

View File

@ -1,9 +1,14 @@
$OpenBSD: patch-dbus_dbus-sysdeps-util-unix_c,v 1.6 2012/12/18 21:38:12 sthen Exp $
$OpenBSD: patch-dbus_dbus-sysdeps-util-unix_c,v 1.7 2013/01/08 09:30:27 ajacoutot Exp $
XXX push upstream
--- dbus/dbus-sysdeps-util-unix.c.orig Fri Sep 28 13:17:25 2012
+++ dbus/dbus-sysdeps-util-unix.c Thu Dec 6 15:20:23 2012
From 9a9b0e2736378d1a8961fb264d7314e921231e8e Mon Sep 17 00:00:00 2001
From: Michel HERMIER <hermier@frugalware.org>
Date: Fri, 09 Nov 2012 15:44:43 +0000
Subject: Don't leak temporary fds pointing to /dev/null
--- dbus/dbus-sysdeps-util-unix.c.orig Fri Sep 28 21:17:25 2012
+++ dbus/dbus-sysdeps-util-unix.c Tue Jan 8 09:59:46 2013
@@ -55,6 +55,13 @@
#include <sys/syslimits.h>
#endif
@ -18,7 +23,15 @@ XXX push upstream
#ifndef O_BINARY
#define O_BINARY 0
#endif
@@ -1107,7 +1114,14 @@ _dbus_command_for_pid (unsigned long pid,
@@ -123,6 +130,7 @@ _dbus_become_daemon (const DBusString *pidfile,
dup2 (dev_null_fd, 2);
else
_dbus_verbose ("keeping stderr open due to DBUS_DEBUG_OUTPUT\n");
+ close (dev_null_fd);
}
if (!keep_umask)
@@ -1107,7 +1115,14 @@ _dbus_command_for_pid (unsigned long pid,
/* This is all Linux-specific for now */
DBusString path;
DBusString cmdline;
@ -33,17 +46,15 @@ XXX push upstream
if (!_dbus_string_init (&path))
{
@@ -1121,7 +1135,8 @@ _dbus_command_for_pid (unsigned long pid,
_dbus_string_free (&path);
@@ -1122,6 +1137,7 @@ _dbus_command_for_pid (unsigned long pid,
return FALSE;
}
-
+
+#ifndef __OpenBSD__
if (!_dbus_string_append_printf (&path, "/proc/%ld/cmdline", pid))
goto oom;
@@ -1148,6 +1163,24 @@ _dbus_command_for_pid (unsigned long pid,
@@ -1148,6 +1164,24 @@ _dbus_command_for_pid (unsigned long pid,
if (!_dbus_close (fd, error))
goto fail;
@ -68,7 +79,7 @@ XXX push upstream
string_squash_nonprintable (&cmdline);
@@ -1162,5 +1195,8 @@ oom:
@@ -1162,5 +1196,8 @@ oom:
fail:
_dbus_string_free (&cmdline);
_dbus_string_free (&path);

View File

@ -0,0 +1,17 @@
$OpenBSD: patch-tools_dbus-launch_c,v 1.1 2013/01/08 09:30:27 ajacoutot Exp $
From 9a9b0e2736378d1a8961fb264d7314e921231e8e Mon Sep 17 00:00:00 2001
From: Michel HERMIER <hermier@frugalware.org>
Date: Fri, 09 Nov 2012 15:44:43 +0000
Subject: Don't leak temporary fds pointing to /dev/null
--- tools/dbus-launch.c.orig Fri Sep 28 21:17:26 2012
+++ tools/dbus-launch.c Tue Jan 8 09:58:11 2013
@@ -633,6 +633,7 @@ babysit (int exit_with_session,
s = getenv ("DBUS_DEBUG_OUTPUT");
if (s == NULL || *s == '\0')
dup2 (dev_null_fd, 2);
+ close (dev_null_fd);
}
else
{