Module Name:    src
Committed By:   drochner
Date:           Thu Jan 20 21:23:11 UTC 2011

Modified Files:
        src/external/historical/nawk/dist: lib.c

Log Message:
avoid crash if certain operations are done before an input record is
read, ie in a BEGIN rule


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/external/historical/nawk/dist/lib.c

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

Modified files:

Index: src/external/historical/nawk/dist/lib.c
diff -u src/external/historical/nawk/dist/lib.c:1.3 src/external/historical/nawk/dist/lib.c:1.4
--- src/external/historical/nawk/dist/lib.c:1.3	Sun Nov  7 22:55:26 2010
+++ src/external/historical/nawk/dist/lib.c	Thu Jan 20 21:23:11 2011
@@ -328,7 +328,9 @@
 	}
 	fr = fields;
 	i = 0;	/* number of fields accumulated here */
-	if (inputFS[0] && inputFS[1]) {	/* it's a regular expression */
+	if (!inputFS) {
+		/* do nothing */
+	} else if (inputFS[0] && inputFS[1]) {	/* it's a regular expression */
 		i = refldbld(r, inputFS);
 	} else if ((sep = *inputFS) == ' ') {	/* default whitespace */
 		for (i = 0; ; ) {

Reply via email to