[Nautilus-list] Fix for zombie pipe by hyperbola



Hi,

just found that since Louise Miller checking for better scrollkeeper
integration, hyperbola is leaking a lot of zombified process when used
with scrollkeeper 0.2 (since it tries to call
scrollkeeper-get-index-from-docpath  which will be only available in CVS
scrollkeeper)..

The following patch fixes these popen leaks.
Can I commit (to both branches) ?
-- 
Frédéric Crozat
MandrakeSoft
--- nautilus-1.0.6/components/help/hyperbola-filefmt.c.orig	Thu Dec  6 15:54:08 2001
+++ nautilus/components/help/hyperbola-filefmt.c	Thu Dec  6 15:53:54 2001
@@ -1137,6 +1137,7 @@
 	FILE *pipe;
 	int i;
 	int bytes_read;
+	int result;
 
 
 	char *doc_uri;
@@ -1201,13 +1202,14 @@
 
                 pipe = popen (toc_location, "r");
                 bytes_read = fread ((void *) toc_location, sizeof (char), 1024, pipe);
+                result = pclose (pipe);
 
                 if (bytes_read > 0) {
                         toc_location[bytes_read - 1] = '\0';
 
 
                         /* Exit code of 0 indicates ScrollKeeper returned a TOC file path */
-                        if (!pclose (pipe)) {
+                        if (!result) {
                                 fmt_scrollkeeper_parse_doc_toc (tree, section,
                                                                 toc_location,
                                                                 doc_uri);
@@ -1223,11 +1225,12 @@
 			    "scrollkeeper-get-index-from-docpath %s", doc_data[1]);
 		pipe = popen (index_location, "r");
 		bytes_read = fread ((void *) index_location, sizeof (char), 1024, pipe);
+		result = pclose (pipe);
 
 		if (bytes_read > 0) {
 			index_location[bytes_read - 1] = '\0';
 			/* Exit code of 0 indicates ScrollKeeper returned an index file */
-			if (!pclose (pipe)) {
+			if (!result) {
 				char *key, *index;
 				key = g_strdup(doc_uri);
 				index = g_strdup(index_location);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]