dmove did not close always close the source file descriptor
authorChristos Zoulas <christos@ucbvax.Berkeley.EDU>
Fri, 28 Jun 1991 10:36:35 +0000 (02:36 -0800)
committerChristos Zoulas <christos@ucbvax.Berkeley.EDU>
Fri, 28 Jun 1991 10:36:35 +0000 (02:36 -0800)
SCCS-vsn: bin/csh/misc.c 5.13

usr/src/bin/csh/misc.c

index b5b09fe..55430b6 100644 (file)
@@ -6,7 +6,7 @@
  */
 
 #ifndef lint
  */
 
 #ifndef lint
-static char sccsid[] = "@(#)misc.c     5.12 (Berkeley) %G%";
+static char sccsid[] = "@(#)misc.c     5.13 (Berkeley) %G%";
 #endif /* not lint */
 
 #include <sys/param.h>
 #endif /* not lint */
 
 #include <sys/param.h>
@@ -249,6 +249,8 @@ dmove(i, j)
        return (i);
     if (j >= 0) {
        (void) dup2(i, j);
        return (i);
     if (j >= 0) {
        (void) dup2(i, j);
+       if (j != i)
+           (void) close(i);
        return (j);
     }
     j = dcopy(i, j);
        return (j);
     }
     j = dcopy(i, j);