[Xfce4-commits] <xfce4-genmon-plugin:master> Don't hang the configuration dialog

Florian Rivoal noreply at xfce.org
Thu Feb 24 15:26:06 CET 2011


Updating branch refs/heads/master
         to 9288f4ad58340a33621be8fb61780e1a7be6d5ea (commit)
       from 597c9ed455deb5570e1b59d9e7a088e0862f4401 (commit)

commit 9288f4ad58340a33621be8fb61780e1a7be6d5ea
Author: Steve Tyler <stephent98 at hotmail.com>
Date:   Thu Feb 24 09:13:48 2011 +0900

    Don't hang the configuration dialog
    
    Commands without output would cause the configuration dialog to hang
    when attempting to close it. This change fixes this, thank to the patch
    provided in bug #4036.

 panel-plugin/cmdspawn.c |    9 ++++++---
 1 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/panel-plugin/cmdspawn.c b/panel-plugin/cmdspawn.c
index b0eafbf..d8d6e46 100644
--- a/panel-plugin/cmdspawn.c
+++ b/panel-plugin/cmdspawn.c
@@ -183,6 +183,7 @@ int genmon_Spawn (char *const argv[], char *const p_pcOutput,
                     close (aaiPipe[i][j]);
             return (-1);
         case 0:
+            close(0); /* stdin is not used in child */
             /* Redirect stdout/stderr to associated pipe's write-ends */
             for (i = 0; i < OUT_ERR; i++) {
                 j = i + 1; // stdout/stderr file descriptor
@@ -199,6 +200,9 @@ int genmon_Spawn (char *const argv[], char *const p_pcOutput,
         exit (-1);
     }
 
+    for (i = 0; i < OUT_ERR; i++)
+        close (aaiPipe[i][WR]); /* close write end of pipes in parent */
+
     /* Wait for child completion */
     if (wait == 1)
     {
@@ -231,10 +235,9 @@ int genmon_Spawn (char *const argv[], char *const p_pcOutput,
     }
 
     End:
-    /* Close created pipes */
+    /* Close read end of pipes */
     for (i = 0; i < OUT_ERR; i++)
-        for (j = 0; j < RD_WR; j++)
-            close (aaiPipe[i][j]);
+        close (aaiPipe[i][RD]);
 
     return (-fError);
 }// Spawn()



More information about the Xfce4-commits mailing list