Hello community,

here is the log from the commit of package qtcurve-kde4 for openSUSE:Factory 
checked in at 2014-01-15 10:12:48
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
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        
2014-01-13 13:52:14.000000000 +0100
+++ /work/SRC/openSUSE:Factory/.qtcurve-kde4.new/qtcurve-kde4.changes   
2014-01-15 10:12:49.000000000 +0100
@@ -1,0 +2,5 @@
+Tue Jan 14 11:47:17 UTC 2014 - [email protected]
+
+- Implement a better runCommand fixing firefox issues.
+
+-------------------------------------------------------------------

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

Other differences:
------------------
++++++ qtcurve-1.8.17-fix_run_command.patch ++++++
--- /var/tmp/diff_new_pack.816lNx/_old  2014-01-15 10:12:51.000000000 +0100
+++ /var/tmp/diff_new_pack.816lNx/_new  2014-01-15 10:12:51.000000000 +0100
@@ -16,19 +16,66 @@
 
 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>
+--- qtcurve-1.8.17.orig/gtk2/style/qt_settings.c       2013-10-18 
14:35:20.000000000 +0200
++++ qtcurve-1.8.17/gtk2/style/qt_settings.c    2014-01-14 12:14:26.740694463 
+0100
+@@ -49,6 +49,11 @@
  #include <sys/types.h>
  #include <math.h>
-+#include <signal.h>
  
++#include <sys/wait.h>
++#include <unistd.h>
++#include <spawn.h>
++#include <poll.h>
++
  QtCPalette qtcPalette;
  Options opts;
-@@ -2936,19 +2937,58 @@ void qtSettingsSetColors(GtkStyle *style
  
- bool runCommand(const char* cmd, char** result)
+@@ -59,12 +64,13 @@ Options opts;
+ #define KDEGLOBALS_FILE     "kdeglobals"
+ #define KDEGLOBALS_SYS_FILE "system.kdeglobals"
+ 
+-static char *getKdeHome()
++static char *getKdeHome(void)
+ {
+     static char *kdeHome = NULL;
++    char *args[] = { "--expandvars", "--localprefix", NULL };
+ 
+     if(!kdeHome) {
+-        if (runCommand("kde4-config --expandvars --localprefix", &kdeHome)) {
++        if (runCommand("kde4-config", args, &kdeHome)) {
+             int len = strlen(kdeHome);
+ 
+             if (len>1 && kdeHome[len-1] == '\n') {
+@@ -284,9 +290,9 @@ static int getMozillaVersion(int pid)
+     {
+         if(read(procFile, cmdline, MAX_LINE_LEN)>2)
+         {
++            char *args[] = { "--version", NULL };
+             char *version=0L;
+-            strcat(cmdline, " --version");
+-            if(runCommand(cmdline, &version))
++            if (runCommand(cmdline, args, &version))
+             {
+                 char *dot=strchr(version, '.');
+ 
+@@ -1283,8 +1289,10 @@ static const char * kdeIconsPrefix()
+     static const char *kdeIcons = NULL;
+ 
+     if (!kdeIcons) {
++        char *args[] = { "--expandvars", "--install", "icon", NULL };
+         char *res = NULL;
+-        if (runCommand("kde4-config --expandvars --install icon", &res)) {
++
++        if (runCommand("kde4-config", args, &res)) {
+             int len = strlen(res);
+             if (len > 1 && res[len - 1]=='\n') {
+                 res[len - 1]='\0';
+@@ -2934,21 +2942,87 @@ void qtSettingsSetColors(GtkStyle *style
+     SET_COLOR(style, rc_style, fg, GTK_RC_FG, GTK_STATE_PRELIGHT, 
COLOR_WINDOW_TEXT)
+ }
+ 
+-bool runCommand(const char* cmd, char** result)
++bool runCommand(const char *cmd, char *const argv[], char** result)
  {
 -    FILE *fp = popen(cmd, "r");
 -    if (fp) {
@@ -40,61 +87,99 @@
 -            currentOffset = bufSize - 1;
 -            bufSize *= 2;
 -            *result = (char*)(realloc(*result, bufSize));
-+    size_t currentOffset = 0;
-+    size_t bufSize = 512;
-+    char *tmp;
-+    FILE *fp;
++    extern char **environ;
++
++    struct pollfd pfd;
++    posix_spawn_file_actions_t action;
++    pid_t pid;
++    size_t buf_size = 512;
++    off_t offset;
++    ssize_t nread;
++    char *output;
++    int p_stdout[2];
++    int status;
 +    int rc;
-+    struct sigaction oldact;
-+    struct sigaction act;
 +
-+    /* Reset SIGCHILD handler to default */
-+    rc = sigaction(SIGCHLD, NULL, &oldact);
-+    if (rc < 0) {
++    output = (char*)(malloc(buf_size));
++    if (output == NULL) {
 +        return false;
 +    }
++    memset(output, '\0', buf_size);
 +
-+    act.sa_flags = SA_RESETHAND;
-+    sigemptyset(&act.sa_mask);
-+
-+    rc = sigaction(SIGCHLD, &act, NULL);
++    rc = pipe(p_stdout);
 +    if (rc < 0) {
-+        return false;
++        goto error;
 +    }
 +
-+    fp = popen(cmd, "r");
-+    if (fp == NULL) {
-+        return false;
++    posix_spawn_file_actions_init(&action);
++    posix_spawn_file_actions_adddup2(&action, p_stdout[1], 1);
++    posix_spawn_file_actions_adddup2(&action, 2, 2);
++
++    if (cmd[0] == '/') {
++        rc = posix_spawn(&pid, cmd, &action, NULL, argv, environ);
++    } else {
++        rc = posix_spawnp(&pid, cmd, &action, NULL, argv, environ);
++    }
++    if (rc != 0) {
++        goto error;
 +    }
 +
-+    *result = (char*)malloc(bufSize);
-+    if (*result == NULL) {
-+        return false;
++    rc = waitpid(pid, &status, 0);
++    if (rc == -1 || status != 0) {
++        goto error;
 +    }
 +
-+    while(feof(fp) == 0 &&
-+          fgets(*result + currentOffset, bufSize - currentOffset, fp) != NULL 
&&
-+          (*result)[strlen(*result) - 1] != '\n') {
++    pfd.fd = p_stdout[0];
++    pfd.events = POLLIN;
++
++    rc = poll(&pfd, 1, 500);
++    if (rc <= 0 || !(pfd.revents & POLLIN)) {
++        goto error;
++    }
++
++    for (nread = read(p_stdout[0], output, buf_size);
++         nread > 0 && output[strlen(output) - 1] != '\n';
++         nread = read(p_stdout[0], output + offset, buf_size - offset))
++    {
 +        char *tmp;
 +
-+        currentOffset = bufSize - 1;
-+        bufSize *= 2;
++        offset = buf_size - 1;
++        buf_size *= 2;
 +
-+        tmp = (char*)(realloc(*result, bufSize));
++        tmp = (char*)(realloc(output, buf_size));
 +        if (tmp == NULL) {
-+            free(*result);
-+            *result = NULL;
-+            return false;
++            goto error;
          }
 -        pclose(fp);
 -        return true;
-+        *result = tmp;
++        memset(tmp + offset, '\0', buf_size - offset);
++        output = tmp;
      }
--    return false;
-+    pclose(fp);
 +
-+    /* Sed old SIGCHILD handler */
-+    sigaction(SIGCHLD, &oldact, NULL);
++    close(p_stdout[0]);
++    close(p_stdout[1]);
++    posix_spawn_file_actions_destroy(&action);
++
++    *result = output;
 +
 +    return true;
++error:
++    free(output);
++    close(p_stdout[0]);
++    close(p_stdout[1]);
++    posix_spawn_file_actions_destroy(&action);
++
+     return false;
  }
+Index: qtcurve-1.8.17/gtk2/style/qt_settings.h
+===================================================================
+--- qtcurve-1.8.17.orig/gtk2/style/qt_settings.h       2013-10-18 
14:35:20.000000000 +0200
++++ qtcurve-1.8.17/gtk2/style/qt_settings.h    2014-01-14 12:11:44.163427027 
+0100
+@@ -182,6 +182,6 @@ extern QtData     qtSettings;
+ gboolean qtSettingsInit();
+ void qtSettingsSetColors(GtkStyle *style, GtkRcStyle *rc_style);
+ const char *getAppName();
+-bool runCommand(const char* cmd, char** result);
++bool runCommand(const char *cmd, char *const argv[], char** result);
+ 
+ #endif

-- 
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to