diff options
author | phantom <phantom@FreeBSD.org> | 2002-02-13 13:00:33 +0000 |
---|---|---|
committer | phantom <phantom@FreeBSD.org> | 2002-02-13 13:00:33 +0000 |
commit | ed060c43f1faf339b375198ce600e1d2b139f467 (patch) | |
tree | 62b83d239a125c28810db167885bf46684a1af5d /usr.bin/gencat | |
parent | 649891b041c164ebdb7da1e81a7dcbc42b709ea5 (diff) | |
download | FreeBSD-src-ed060c43f1faf339b375198ce600e1d2b139f467.zip FreeBSD-src-ed060c43f1faf339b375198ce600e1d2b139f467.tar.gz |
* Don't SEGFAULT on attempt to write nothing (if no source files were
specified)
* Don't print currline if it's NULL
MFC after: 3 days
Diffstat (limited to 'usr.bin/gencat')
-rw-r--r-- | usr.bin/gencat/genlib.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/usr.bin/gencat/genlib.c b/usr.bin/gencat/genlib.c index e1a55bf..185f2a0 100644 --- a/usr.bin/gencat/genlib.c +++ b/usr.bin/gencat/genlib.c @@ -49,7 +49,7 @@ static long lineno = 0; static void warning(char *cptr, const char *msg) { - warnx("%s on line %ld\n%s", msg, lineno, curline); + warnx("%s on line %ld\n%s", msg, lineno, (curline == NULL ? "" : curline) ); if (cptr) { char *tptr; for (tptr = curline; tptr < cptr; ++tptr) putc(' ', stderr); @@ -559,6 +559,9 @@ MCWriteCat(int fd) mcHead.flags = MCGetByteOrder(); mcHead.firstSet = 0; /* We'll be back to set this in a minute */ + if (cat == NULL) + error(NULL, "cannot write empty catalog set"); + for (cnt = 0, set = cat->first; set; set = set->next) ++cnt; mcHead.numSets = cnt; |