Source-Changes-HG archive

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

[src/trunk]: src/bin/sh When verifying the size of the fd arg for fdflags ski...



details:   https://anonhg.NetBSD.org/src/rev/d722f8f5912a
branches:  trunk
changeset: 353173:d722f8f5912a
user:      kre <kre%NetBSD.org@localhost>
date:      Sat Apr 22 15:54:53 2017 +0000

description:
When verifying the size of the fd arg for fdflags skip leading 0's
(fdflags 0000000001 should work, fdflags 10000000 should not)

diffstat:

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

diffs (27 lines):

diff -r 99497ec42bb8 -r d722f8f5912a bin/sh/redir.c
--- a/bin/sh/redir.c    Sat Apr 22 15:53:17 2017 +0000
+++ b/bin/sh/redir.c    Sat Apr 22 15:54:53 2017 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: redir.c,v 1.51 2017/02/03 23:16:38 kre Exp $   */
+/*     $NetBSD: redir.c,v 1.52 2017/04/22 15:54:53 kre 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.51 2017/02/03 23:16:38 kre Exp $");
+__RCSID("$NetBSD: redir.c,v 1.52 2017/04/22 15:54:53 kre Exp $");
 #endif
 #endif /* not lint */
 
@@ -761,6 +761,8 @@
        while ((num = *argv++) != NULL) {
                int fd = number(num);
 
+               while (num[0] == '0' && num[1] != '\0')         /* skip 0's */
+                       num++;
                if (strlen(num) > 5)
                        error("%s too big to be a file descriptor", num);
 



Home | Main Index | Thread Index | Old Index