Merge some patches from upstream to fix a couple of crashes.

This commit is contained in:
ajacoutot 2013-05-09 14:06:38 +00:00
parent 5ff218fe82
commit a63d31f5e6
4 changed files with 155 additions and 1 deletions

View File

@ -1,4 +1,4 @@
# $OpenBSD: Makefile,v 1.204 2013/04/16 06:01:54 ajacoutot Exp $
# $OpenBSD: Makefile,v 1.205 2013/05/09 14:06:38 ajacoutot Exp $
COMMENT= general-purpose utility library
@ -6,6 +6,8 @@ GNOME_PROJECT= glib
GNOME_VERSION= 2.36.1
PKGNAME= ${DISTNAME:S/glib/glib2/}
REVISION= 0
CATEGORIES= devel
HOMEPAGE= http://www.gtk.org/

View File

@ -0,0 +1,18 @@
$OpenBSD: patch-gio_gemblemedicon_c,v 1.1 2013/05/09 14:06:38 ajacoutot Exp $
From 91179be5a82a55c32ddc61821430aef0b0f3fa48 Mon Sep 17 00:00:00 2001
From: Matthias Clasen <mclasen@redhat.com>
Date: Fri, 03 May 2013 01:00:57 +0000
Subject: Silently handle icon being NULL
--- gio/gemblemedicon.c.orig Fri Apr 12 18:04:23 2013
+++ gio/gemblemedicon.c Thu May 9 15:52:16 2013
@@ -72,7 +72,7 @@ g_emblemed_icon_finalize (GObject *object)
emblemed = G_EMBLEMED_ICON (object);
- g_object_unref (emblemed->priv->icon);
+ g_clear_object (&emblemed->priv->icon);
g_list_free_full (emblemed->priv->emblems, g_object_unref);
(*G_OBJECT_CLASS (g_emblemed_icon_parent_class)->finalize) (object);

View File

@ -0,0 +1,18 @@
$OpenBSD: patch-gio_gsocks5proxy_c,v 1.1 2013/05/09 14:06:38 ajacoutot Exp $
From 0ba982e0589c2ae246dca760010d54bbca371399 Mon Sep 17 00:00:00 2001
From: Simon McVittie <simon.mcvittie@collabora.co.uk>
Date: Thu, 02 May 2013 15:50:01 +0000
Subject: GSocks5Proxy: don't crash if parsing negotiation reply fails
--- gio/gsocks5proxy.c.orig Mon Apr 15 23:22:13 2013
+++ gio/gsocks5proxy.c Thu May 9 15:52:14 2013
@@ -708,7 +708,7 @@ nego_reply_read_cb (GObject *source,
if (data->offset == data->length)
{
- GError *error;
+ GError *error = NULL;
gboolean must_auth = FALSE;
gboolean has_auth = data->username || data->password;

View File

@ -0,0 +1,116 @@
$OpenBSD: patch-glib_gspawn_c,v 1.1 2013/05/09 14:06:38 ajacoutot Exp $
From f3b1054b0ebb4912f700e08da0c3d35c30113e79 Mon Sep 17 00:00:00 2001
From: Ryan Lortie <desrt@desrt.ca>
Date: Tue, 23 Apr 2013 17:26:48 +0000
Subject: Partially revert "Merge waitpid() from g_spawn_sync into gmain()"
--- glib/gspawn.c.orig Mon Apr 15 23:22:13 2013
+++ glib/gspawn.c Thu May 9 15:52:12 2013
@@ -47,7 +47,6 @@
#include "genviron.h"
#include "gmem.h"
-#include "gmain.h"
#include "gshell.h"
#include "gstring.h"
#include "gstrfuncs.h"
@@ -207,21 +206,6 @@ read_data (GString *str,
}
}
-typedef struct {
- GMainLoop *loop;
- gint *status_p;
-} SyncWaitpidData;
-
-static void
-on_sync_waitpid (GPid pid,
- gint status,
- gpointer user_data)
-{
- SyncWaitpidData *data = user_data;
- *(data->status_p) = status;
- g_main_loop_quit (data->loop);
-}
-
/**
* g_spawn_sync:
* @working_directory: (allow-none): child's current working directory, or %NULL to inherit parent's
@@ -277,7 +261,6 @@ g_spawn_sync (const gchar *working_directory,
GString *errstr = NULL;
gboolean failed;
gint status;
- SyncWaitpidData waitpid_data;
g_return_val_if_fail (argv != NULL, FALSE);
g_return_val_if_fail (!(flags & G_SPAWN_DO_NOT_REAP_CHILD), FALSE);
@@ -410,32 +393,45 @@ g_spawn_sync (const gchar *working_directory,
close_and_invalidate (&outpipe);
if (errpipe >= 0)
close_and_invalidate (&errpipe);
-
- /* Now create a temporary main context and loop, with just one
- * waitpid source. We used to invoke waitpid() directly here, but
- * this way we unify with the worker thread in gmain.c.
+
+ /* Wait for child to exit, even if we have
+ * an error pending.
*/
- {
- GMainContext *context;
- GMainLoop *loop;
- GSource *source;
+ again:
+
+ ret = waitpid (pid, &status, 0);
- context = g_main_context_new ();
- loop = g_main_loop_new (context, TRUE);
+ if (ret < 0)
+ {
+ if (errno == EINTR)
+ goto again;
+ else if (errno == ECHILD)
+ {
+ if (exit_status)
+ {
+ g_warning ("In call to g_spawn_sync(), exit status of a child process was requested but ECHILD was received by waitpid(). Most likely the process is ignoring SIGCHLD, or some other thread is invoking waitpid() with a nonpositive first argument; either behavior can break applications that use g_spawn_sync either directly or indirectly.");
+ }
+ else
+ {
+ /* We don't need the exit status. */
+ }
+ }
+ else
+ {
+ if (!failed) /* avoid error pileups */
+ {
+ int errsv = errno;
- waitpid_data.loop = loop;
- waitpid_data.status_p = &status;
-
- source = g_child_watch_source_new (pid);
- g_source_set_callback (source, (GSourceFunc)on_sync_waitpid, &waitpid_data, NULL);
- g_source_attach (source, context);
- g_source_unref (source);
-
- g_main_loop_run (loop);
-
- g_main_context_unref (context);
- g_main_loop_unref (loop);
- }
+ failed = TRUE;
+
+ g_set_error (error,
+ G_SPAWN_ERROR,
+ G_SPAWN_ERROR_READ,
+ _("Unexpected error in waitpid() (%s)"),
+ g_strerror (errsv));
+ }
+ }
+ }
if (failed)
{