diff options
Diffstat (limited to 'usr.sbin/hoststatectl/parser.c')
-rw-r--r-- | usr.sbin/hoststatectl/parser.c | 26 |
1 files changed, 16 insertions, 10 deletions
diff --git a/usr.sbin/hoststatectl/parser.c b/usr.sbin/hoststatectl/parser.c index 2f535990ed9..43703a6622b 100644 --- a/usr.sbin/hoststatectl/parser.c +++ b/usr.sbin/hoststatectl/parser.c @@ -1,4 +1,4 @@ -/* $OpenBSD: parser.c,v 1.3 2006/12/16 17:53:03 deraadt Exp $ */ +/* $OpenBSD: parser.c,v 1.4 2006/12/16 18:50:33 reyk Exp $ */ /* * Copyright (c) 2006 Pierre-Yves Ritschard <pyr@spootnik.org> @@ -166,23 +166,29 @@ match_token(const char *word, const struct token table[]) } break; case HOSTID: - res.id = strtonum(word, 0, UINT_MAX, &errstr); - if (errstr) - errx(1, "host id %s is %s", word, errstr); + res.id.id = strtonum(word, 0, UINT_MAX, &errstr); + if (errstr) { + strlcpy(res.id.name, word, sizeof(res.id.name)); + res.id.id = EMPTY_ID; + } t = &table[i]; match++; break; case TABLEID: - res.id = strtonum(word, 0, UINT_MAX, &errstr); - if (errstr) - errx(1, "table id %s is %s", word, errstr); + res.id.id = strtonum(word, 0, UINT_MAX, &errstr); + if (errstr) { + strlcpy(res.id.name, word, sizeof(res.id.name)); + res.id.id = EMPTY_ID; + } t = &table[i]; match++; break; case SERVICEID: - res.id = strtonum(word, 0, UINT_MAX, &errstr); - if (errstr) - errx(1, "service id %s is %s", word, errstr); + res.id.id = strtonum(word, 0, UINT_MAX, &errstr); + if (errstr) { + strlcpy(res.id.name, word, sizeof(res.id.name)); + res.id.id = EMPTY_ID; + } t = &table[i]; match++; break; |