diff options
author | Alexey Zelkin <phantom@FreeBSD.org> | 2002-02-13 13:00:33 +0000 |
---|---|---|
committer | Alexey Zelkin <phantom@FreeBSD.org> | 2002-02-13 13:00:33 +0000 |
commit | e0c90a7bd52c7effc63eba3fb4c1c1021038142c (patch) | |
tree | 62b83d239a125c28810db167885bf46684a1af5d /usr.bin/gencat | |
parent | 1603684d773140732ae0ccb04b2e60eabb071f43 (diff) | |
download | src-e0c90a7bd52c7effc63eba3fb4c1c1021038142c.tar.gz src-e0c90a7bd52c7effc63eba3fb4c1c1021038142c.zip |
* 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
Notes
Notes:
svn path=/head/; revision=90609
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 e1a55bfbc66c..185f2a029cbf 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; |