Module Name:    src
Committed By:   kre
Date:           Sat Apr 22 15:54:53 UTC 2017

Modified Files:
        src/bin/sh: redir.c

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


To generate a diff of this commit:
cvs rdiff -u -r1.51 -r1.52 src/bin/sh/redir.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/bin/sh/redir.c
diff -u src/bin/sh/redir.c:1.51 src/bin/sh/redir.c:1.52
--- src/bin/sh/redir.c:1.51	Fri Feb  3 23:16:38 2017
+++ src/bin/sh/redir.c	Sat Apr 22 15:54:53 2017
@@ -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 @@ fdflagscmd(int argc, char *argv[])
 	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);
 

Reply via email to