1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-11-28 08:02:54 +00:00

* 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
This commit is contained in:
Alexey Zelkin 2002-02-13 13:00:33 +00:00
parent 1603684d77
commit e0c90a7bd5
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=90609

View File

@ -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;