gnash-commit
[Top][All Lists]
Advanced

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

[Gnash-commit] gnash plugin/plugin.cpp ChangeLog


From: John Gilmore
Subject: [Gnash-commit] gnash plugin/plugin.cpp ChangeLog
Date: Sat, 21 Apr 2007 07:05:42 +0000

CVSROOT:        /sources/gnash
Module name:    gnash
Changes by:     John Gilmore <jgilmore> 07/04/21 07:05:41

Modified files:
        plugin         : plugin.cpp 
        .              : ChangeLog 

Log message:
        * plugin/plugin.cpp:  In the child process, before executing
          gnash, close all the file descriptors we inherited from the
          browser (except stdout and stderr).

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/gnash/plugin/plugin.cpp?cvsroot=gnash&r1=1.74&r2=1.75
http://cvs.savannah.gnu.org/viewcvs/gnash/ChangeLog?cvsroot=gnash&r1=1.2960&r2=1.2961

Patches:
Index: plugin/plugin.cpp
===================================================================
RCS file: /sources/gnash/gnash/plugin/plugin.cpp,v
retrieving revision 1.74
retrieving revision 1.75
diff -u -b -r1.74 -r1.75
--- plugin/plugin.cpp   11 Apr 2007 17:54:21 -0000      1.74
+++ plugin/plugin.cpp   21 Apr 2007 07:05:41 -0000      1.75
@@ -14,7 +14,7 @@
 // along with this program; if not, write to the Free Software
 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 
-/* $Id: plugin.cpp,v 1.74 2007/04/11 17:54:21 bjacques Exp $ */
+/* $Id: plugin.cpp,v 1.75 2007/04/21 07:05:41 jgilmore Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include "config.h"
@@ -525,6 +525,22 @@
       cout << "ERROR: dup2() failed: " << strerror(errno) << endl;
     }
 
+    // Close all of the browser's file descriptors that we just 
+    // inherited (including pipefd[0] that we just dup'd to fd 0).
+    // Experiments show seventy or eighty file descriptors open in
+    // typical cases.  Rather than close all the thousands of possible file
+    // descriptors, we start after stderr and keep closing higher numbers
+    // until we encounter ten fd's in a row that
+    // aren't open.  This will tend to close most fd's in most programms.
+    int numfailed = 0, closed = 0;
+    int anfd = fileno(stderr)+1;
+    for ( ; numfailed < 10; anfd++) {
+       ret = close (anfd);
+       if (ret < 0) numfailed++;
+       else         { numfailed = 0; closed++; }
+    }
+    cout << "Closed " << closed << "files." <<endl;
+
     // setup the command line
 
     const char* pageurl = getCurrentPageURL();

Index: ChangeLog
===================================================================
RCS file: /sources/gnash/gnash/ChangeLog,v
retrieving revision 1.2960
retrieving revision 1.2961
diff -u -b -r1.2960 -r1.2961
--- ChangeLog   20 Apr 2007 16:42:43 -0000      1.2960
+++ ChangeLog   21 Apr 2007 07:05:41 -0000      1.2961
@@ -1,3 +1,9 @@
+2007-04-21  John Gilmore  <address@hidden>
+
+       * plugin/plugin.cpp:  In the child process, before executing
+         gnash, close all the file descriptors we inherited from the
+         browser (except stdout and stderr).
+
 2007-04-20 Sandro Santilli <address@hidden>
 
        * testsuite/MovieTester.{cpp,h}: reworked the




reply via email to

[Prev in Thread] Current Thread [Next in Thread]