If parameter don't have values, then 'continue' after setting the flag bit.
Fixes coverty CID 776 and removes the need for a 'val = NULL' added to appease gcc's undefined variable tests. This parsing code sucks though, it doesn't correctly check for the '=' between a parameter and its value, whitespace can be used instead.
This commit is contained in:
parent
38d8c6bf5c
commit
c0b0ba1f18
|
@ -1,4 +1,4 @@
|
||||||
/* $NetBSD: spec.c,v 1.61 2005/10/01 20:28:22 christos Exp $ */
|
/* $NetBSD: spec.c,v 1.62 2006/04/12 19:49:59 dsl Exp $ */
|
||||||
|
|
||||||
/*-
|
/*-
|
||||||
* Copyright (c) 1989, 1993
|
* Copyright (c) 1989, 1993
|
||||||
|
@ -74,7 +74,7 @@
|
||||||
#if 0
|
#if 0
|
||||||
static char sccsid[] = "@(#)spec.c 8.2 (Berkeley) 4/28/95";
|
static char sccsid[] = "@(#)spec.c 8.2 (Berkeley) 4/28/95";
|
||||||
#else
|
#else
|
||||||
__RCSID("$NetBSD: spec.c,v 1.61 2005/10/01 20:28:22 christos Exp $");
|
__RCSID("$NetBSD: spec.c,v 1.62 2006/04/12 19:49:59 dsl Exp $");
|
||||||
#endif
|
#endif
|
||||||
#endif /* not lint */
|
#endif /* not lint */
|
||||||
|
|
||||||
|
@ -506,21 +506,20 @@ set(char *t, NODE *ip)
|
||||||
char *kw, *val, *md, *ep;
|
char *kw, *val, *md, *ep;
|
||||||
void *m;
|
void *m;
|
||||||
|
|
||||||
val = NULL;
|
|
||||||
while ((kw = strsep(&t, "= \t")) != NULL) {
|
while ((kw = strsep(&t, "= \t")) != NULL) {
|
||||||
if (*kw == '\0')
|
if (*kw == '\0')
|
||||||
continue;
|
continue;
|
||||||
if (strcmp(kw, "all") == 0)
|
if (strcmp(kw, "all") == 0)
|
||||||
mtree_err("invalid keyword `all'");
|
mtree_err("invalid keyword `all'");
|
||||||
ip->flags |= type = parsekey(kw, &value);
|
ip->flags |= type = parsekey(kw, &value);
|
||||||
if (value) {
|
if (!value)
|
||||||
while ((val = strsep(&t, " \t")) != NULL &&
|
/* Just set flag bit (F_IGN and F_OPT) */
|
||||||
*val == '\0')
|
continue;
|
||||||
continue;
|
while ((val = strsep(&t, " \t")) != NULL && *val == '\0')
|
||||||
if (val == NULL)
|
continue;
|
||||||
mtree_err("missing value");
|
if (val == NULL)
|
||||||
}
|
mtree_err("missing value");
|
||||||
switch(type) {
|
switch (type) {
|
||||||
case F_CKSUM:
|
case F_CKSUM:
|
||||||
ip->cksum = strtoul(val, &ep, 10);
|
ip->cksum = strtoul(val, &ep, 10);
|
||||||
if (*ep)
|
if (*ep)
|
||||||
|
@ -548,9 +547,6 @@ set(char *t, NODE *ip)
|
||||||
mtree_err("unknown group `%s'", val);
|
mtree_err("unknown group `%s'", val);
|
||||||
ip->st_gid = gid;
|
ip->st_gid = gid;
|
||||||
break;
|
break;
|
||||||
case F_IGN:
|
|
||||||
/* just set flag bit */
|
|
||||||
break;
|
|
||||||
case F_MD5:
|
case F_MD5:
|
||||||
if (val[0]=='0' && val[1]=='x')
|
if (val[0]=='0' && val[1]=='x')
|
||||||
md=&val[2];
|
md=&val[2];
|
||||||
|
@ -571,9 +567,6 @@ set(char *t, NODE *ip)
|
||||||
if (*ep)
|
if (*ep)
|
||||||
mtree_err("invalid link count `%s'", val);
|
mtree_err("invalid link count `%s'", val);
|
||||||
break;
|
break;
|
||||||
case F_OPT:
|
|
||||||
/* just set flag bit */
|
|
||||||
break;
|
|
||||||
case F_RMD160:
|
case F_RMD160:
|
||||||
if (val[0]=='0' && val[1]=='x')
|
if (val[0]=='0' && val[1]=='x')
|
||||||
md=&val[2];
|
md=&val[2];
|
||||||
|
|
Loading…
Reference in New Issue