Hello community,

here is the log from the commit of package qtcurve-kde4 for openSUSE:Factory 
checked in at 2014-01-13 13:52:13
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/qtcurve-kde4 (Old)
 and      /work/SRC/openSUSE:Factory/.qtcurve-kde4.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "qtcurve-kde4"

Changes:
--------
--- /work/SRC/openSUSE:Factory/qtcurve-kde4/qtcurve-kde4.changes        
2013-11-13 09:46:00.000000000 +0100
+++ /work/SRC/openSUSE:Factory/.qtcurve-kde4.new/qtcurve-kde4.changes   
2014-01-13 13:52:14.000000000 +0100
@@ -1,0 +2,6 @@
+Sat Jan 11 10:44:12 UTC 2014 - a...@cryptomilk.org
+
+- bnc#858403 - Fix bug starting up GTK2+ applications.
+  + Added patch qtcurve-1.8.17-fix_run_command.patch
+
+-------------------------------------------------------------------

New:
----
  qtcurve-1.8.17-fix_run_command.patch

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ qtcurve-kde4.spec ++++++
--- /var/tmp/diff_new_pack.QtUQ4d/_old  2014-01-13 13:52:15.000000000 +0100
+++ /var/tmp/diff_new_pack.QtUQ4d/_new  2014-01-13 13:52:15.000000000 +0100
@@ -1,7 +1,7 @@
 #
 # spec file for package qtcurve-kde4
 #
-# Copyright (c) 2013 SUSE LINUX Products GmbH, Nuernberg, Germany.
+# Copyright (c) 2014 SUSE LINUX Products GmbH, Nuernberg, Germany.
 #
 # All modifications and additions to the file contributed by third parties
 # remain the property of their copyright owners, unless otherwise agreed
@@ -24,6 +24,10 @@
 Group:          System/GUI/KDE
 Url:            https://github.com/QtCurve/qtcurve
 Source0:        %{version}.tar.gz
+
+# PATCH-FIX-UPSTREAM qtcurve-1.8.17-fix_run_command.patch bnc#858403
+Patch0:         qtcurve-1.8.17-fix_run_command.patch
+
 BuildRequires:  gtk2-devel
 BuildRequires:  kdebase4-workspace-devel
 BuildRequires:  pkgconfig(xcb-image)
@@ -54,6 +58,7 @@
 
 %prep
 %setup -q -n qtcurve-%{version}
+%patch0 -p1 -b .qtcurve-1.8.17-fix_run_command.patch
 
 %build
 # Don't build Qt5 deco/style yet

++++++ qtcurve-1.8.17-fix_run_command.patch ++++++
>From f55d663fefc51d21e7153da5071485f4d1f07aed Mon Sep 17 00:00:00 2001
From: Andreas Schneider <a...@cryptomilk.org>
Date: Sat, 11 Jan 2014 14:35:38 +0100
Subject: [PATCH] gtk2: Fix runCommand SIGCHILD race condition.

The SIGCHILD handler gets replaced which could cause race conditions on
fast machines. This patch resets the SIGCHILD handler to the default
before we call popen() and restores it afterwards.

Fixes issue #41.

Signed-off-by: Andreas Schneider <a...@cryptomilk.org>
---
 gtk2/style/qt_settings.c | 66 ++++++++++++++++++++++++++++++++++++++----------
 1 file changed, 53 insertions(+), 13 deletions(-)

Index: qtcurve-1.8.17/gtk2/style/qt_settings.c
===================================================================
--- qtcurve-1.8.17.orig/gtk2/style/qt_settings.c        2014-01-11 
14:49:27.487412235 +0100
+++ qtcurve-1.8.17/gtk2/style/qt_settings.c     2014-01-11 14:49:50.655607327 
+0100
@@ -48,6 +48,7 @@
 #include <pwd.h>
 #include <sys/types.h>
 #include <math.h>
+#include <signal.h>
 
 QtCPalette qtcPalette;
 Options opts;
@@ -2936,19 +2937,58 @@ void qtSettingsSetColors(GtkStyle *style
 
 bool runCommand(const char* cmd, char** result)
 {
-    FILE *fp = popen(cmd, "r");
-    if (fp) {
-        gulong bufSize = 512;
-        size_t currentOffset = 0;
-        *result = (char*)(malloc(bufSize));
-        while(fgets(*result + currentOffset, bufSize - currentOffset, fp) &&
-              (*result)[strlen(*result) - 1] != '\n') {
-            currentOffset = bufSize - 1;
-            bufSize *= 2;
-            *result = (char*)(realloc(*result, bufSize));
+    size_t currentOffset = 0;
+    size_t bufSize = 512;
+    char *tmp;
+    FILE *fp;
+    int rc;
+    struct sigaction oldact;
+    struct sigaction act;
+
+    /* Reset SIGCHILD handler to default */
+    rc = sigaction(SIGCHLD, NULL, &oldact);
+    if (rc < 0) {
+        return false;
+    }
+
+    act.sa_flags = SA_RESETHAND;
+    sigemptyset(&act.sa_mask);
+
+    rc = sigaction(SIGCHLD, &act, NULL);
+    if (rc < 0) {
+        return false;
+    }
+
+    fp = popen(cmd, "r");
+    if (fp == NULL) {
+        return false;
+    }
+
+    *result = (char*)malloc(bufSize);
+    if (*result == NULL) {
+        return false;
+    }
+
+    while(feof(fp) == 0 &&
+          fgets(*result + currentOffset, bufSize - currentOffset, fp) != NULL 
&&
+          (*result)[strlen(*result) - 1] != '\n') {
+        char *tmp;
+
+        currentOffset = bufSize - 1;
+        bufSize *= 2;
+
+        tmp = (char*)(realloc(*result, bufSize));
+        if (tmp == NULL) {
+            free(*result);
+            *result = NULL;
+            return false;
         }
-        pclose(fp);
-        return true;
+        *result = tmp;
     }
-    return false;
+    pclose(fp);
+
+    /* Sed old SIGCHILD handler */
+    sigaction(SIGCHLD, &oldact, NULL);
+
+    return true;
 }
-- 
To unsubscribe, e-mail: opensuse-commit+unsubscr...@opensuse.org
For additional commands, e-mail: opensuse-commit+h...@opensuse.org

Reply via email to