Source-Changes-HG archive

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

[src/trunk]: src/bin/sh Test for REDIR_KEEP in the non-copy case:



details:   https://anonhg.NetBSD.org/src/rev/1ee9774ad263
branches:  trunk
changeset: 344101:1ee9774ad263
user:      christos <christos%NetBSD.org@localhost>
date:      Sun Mar 13 00:52:05 2016 +0000

description:
Test for REDIR_KEEP in the non-copy case:
        $ cat other1
        #!/bin/sh
        ./other2 3>out

        $ cat other2
        #!/bin/sh
        echo other2 1>&3

        $ ./other1

diffstat:

 bin/sh/redir.c |  6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diffs (27 lines):

diff -r 89a6f1dee41e -r 1ee9774ad263 bin/sh/redir.c
--- a/bin/sh/redir.c    Sun Mar 13 00:33:12 2016 +0000
+++ b/bin/sh/redir.c    Sun Mar 13 00:52:05 2016 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: redir.c,v 1.40 2016/03/12 21:35:13 christos Exp $      */
+/*     $NetBSD: redir.c,v 1.41 2016/03/13 00:52:05 christos Exp $      */
 
 /*-
  * Copyright (c) 1991, 1993
@@ -37,7 +37,7 @@
 #if 0
 static char sccsid[] = "@(#)redir.c    8.2 (Berkeley) 5/4/95";
 #else
-__RCSID("$NetBSD: redir.c,v 1.40 2016/03/12 21:35:13 christos Exp $");
+__RCSID("$NetBSD: redir.c,v 1.41 2016/03/13 00:52:05 christos Exp $");
 #endif
 #endif /* not lint */
 
@@ -246,7 +246,7 @@
        if (f != fd) {
                copyfd(f, fd, 1, fd > 2 && (flags & REDIR_KEEP) == 0);
                close(f);
-       } else if (f > 2)
+       } else if (f > 2 && (flags & REDIR_KEEP) == 0)
                (void)fcntl(f, F_SETFD, FD_CLOEXEC);
 
        INTON;



Home | Main Index | Thread Index | Old Index