diff options
author | Marc Espie <espie@cvs.openbsd.org> | 2008-06-13 20:47:30 +0000 |
---|---|---|
committer | Marc Espie <espie@cvs.openbsd.org> | 2008-06-13 20:47:30 +0000 |
commit | 6de47580a7d1b6e2b4ab4c332a5385825eca8f43 (patch) | |
tree | cd3aa9a2b051bd43888788d90945713fccee02cc | |
parent | db6b79e7bf8bec764868756b325add60ad1f6e33 (diff) |
fix two smalls bugs wrt contination lines.
- continuation line at file start would segfault: make it change ginfo
as it should instead.
- empty continuation lines should be valid.
okay millert@
-rw-r--r-- | usr.sbin/mtree/spec.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/usr.sbin/mtree/spec.c b/usr.sbin/mtree/spec.c index c0d75bfc78e..27958df5375 100644 --- a/usr.sbin/mtree/spec.c +++ b/usr.sbin/mtree/spec.c @@ -1,5 +1,5 @@ /* $NetBSD: spec.c,v 1.6 1995/03/07 21:12:12 cgd Exp $ */ -/* $OpenBSD: spec.c,v 1.23 2005/08/10 00:42:09 millert Exp $ */ +/* $OpenBSD: spec.c,v 1.24 2008/06/13 20:47:29 espie Exp $ */ /*- * Copyright (c) 1989, 1993 @@ -34,7 +34,7 @@ #if 0 static const char sccsid[] = "@(#)spec.c 8.1 (Berkeley) 6/6/93"; #else -static const char rcsid[] = "$OpenBSD: spec.c,v 1.23 2005/08/10 00:42:09 millert Exp $"; +static const char rcsid[] = "$OpenBSD: spec.c,v 1.24 2008/06/13 20:47:29 espie Exp $"; #endif #endif /* not lint */ @@ -65,8 +65,9 @@ spec(void) char *buf, *tbuf = NULL; size_t len; - centry = last = root = NULL; + last = root = NULL; bzero(&ginfo, sizeof(ginfo)); + centry = &ginfo; c_cur = c_next = 0; for (lineno = 1; (buf = fgetln(stdin, &len)); ++lineno, c_cur = c_next, c_next = 0) { @@ -91,10 +92,10 @@ spec(void) /* See if next line is continuation line. */ if (buf[len - 1] == '\\') { + c_next = 1; if (--len == 0) continue; buf[len] = '\0'; - c_next = 1; } #ifdef DEBUG |