[Commit] nickle ChangeLog,1.66,1.67 file.5c,1.4,1.5

Keith Packard commit at keithp.com
Sun Jun 13 23:58:34 PDT 2004


Committed by: keithp

Update of /local/src/CVS/nickle
In directory home.keithp.com:/tmp/cvs-serv6356

Modified Files:
	ChangeLog file.5c 
Log Message:
2004-06-13  Keith Packard  <keithp at keithp.com>

	* file.5c:
	Don't open /dev/null until needed for mkchild


Index: ChangeLog
===================================================================
RCS file: /local/src/CVS/nickle/ChangeLog,v
retrieving revision 1.66
retrieving revision 1.67
diff -u -d -r1.66 -r1.67
--- a/ChangeLog	14 Jun 2004 06:43:33 -0000	1.66
+++ b/ChangeLog	14 Jun 2004 06:58:32 -0000	1.67
@@ -1,5 +1,10 @@
 2004-06-13  Keith Packard  <keithp at keithp.com>
 
+	* file.5c:
+	Don't open /dev/null until needed for mkchild
+
+2004-06-13  Keith Packard  <keithp at keithp.com>
+
 	* abort.5c:
 	* arc4.5c:
 	* builtin-namespaces.h:

Index: file.5c
===================================================================
RCS file: /local/src/CVS/nickle/file.5c,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- a/file.5c	14 Jun 2004 06:43:33 -0000	1.4
+++ b/file.5c	14 Jun 2004 06:58:32 -0000	1.5
@@ -6,7 +6,13 @@
  */
 
 extend namespace File {
-    public stdnull = open("/dev/null", "r+");
+    public file stdnull () { 
+	static bool set = false;
+	static file f;
+	if (!set)
+	    f = open("/dev/null", "r+");
+	return f;
+    }
 
     public typedef union {
 	file input;
@@ -20,7 +26,7 @@
 	 * This is what happens when you fork()
 	 */
     {
-	file[3] filter_fds = { stdnull, ... };
+	file[3] filter_fds = { stdnull(), ... };
 	for (int i = 0; i < dim(fds); i++) {
 	    union switch(fds[i]) {
 	    case input f: filter_fds[0] = f; break;




More information about the Commit mailing list