Add extra file descriptor dups to make sure 0,1,2 exist
authorChristos Zoulas <christos@ucbvax.Berkeley.EDU>
Fri, 15 May 1992 15:14:21 +0000 (07:14 -0800)
committerChristos Zoulas <christos@ucbvax.Berkeley.EDU>
Fri, 15 May 1992 15:14:21 +0000 (07:14 -0800)
SCCS-vsn: bin/csh/glob.c 5.36

usr/src/bin/csh/glob.c

index 13fad14..0a03e5d 100644 (file)
@@ -6,7 +6,7 @@
  */
 
 #ifndef lint
  */
 
 #ifndef lint
-static char sccsid[] = "@(#)glob.c     5.35 (Berkeley) %G%";
+static char sccsid[] = "@(#)glob.c     5.36 (Berkeley) %G%";
 #endif /* not lint */
 
 #include <sys/param.h>
 #endif /* not lint */
 
 #include <sys/param.h>
@@ -643,6 +643,17 @@ backeval(cp, literal)
     fakecom[0] = STRfakecom1;
     fakecom[1] = 0;
 
     fakecom[0] = STRfakecom1;
     fakecom[1] = 0;
 
+    if (didfds == 0) {
+       /*
+        * Make sure that we have some file descriptors to
+        * play with, so that the processes have at least 0, 1, 2
+        * open
+        */
+       (void) dcopy(SHIN, 0);
+       (void) dcopy(SHOUT, 1);
+       (void) dcopy(SHERR, 2);
+    }
+
     /*
      * We do the psave job to temporarily change the current job so that the
      * following fork is considered a separate job.  This is so that when
     /*
      * We do the psave job to temporarily change the current job so that the
      * following fork is considered a separate job.  This is so that when