diff options
author | Ingo Schwarze <schwarze@cvs.openbsd.org> | 2016-08-09 15:08:16 +0000 |
---|---|---|
committer | Ingo Schwarze <schwarze@cvs.openbsd.org> | 2016-08-09 15:08:16 +0000 |
commit | 367e409ead98402f753f6650813d50c45a6da5d3 (patch) | |
tree | 9734914f803b4ed5daf28e25f4ede4407d1084e9 | |
parent | cc4351733ea0d248fb82dc73129e8be6f138a9c7 (diff) |
fix printf("%s", NULL);
found while investigating an unrelated bug report from jsg@
-rw-r--r-- | usr.bin/mandoc/main.c | 5 | ||||
-rw-r--r-- | usr.bin/mandoc/mdoc_validate.c | 9 |
2 files changed, 8 insertions, 6 deletions
diff --git a/usr.bin/mandoc/main.c b/usr.bin/mandoc/main.c index 45f5c52d9f7..c2208c9d0d8 100644 --- a/usr.bin/mandoc/main.c +++ b/usr.bin/mandoc/main.c @@ -1,4 +1,4 @@ -/* $OpenBSD: main.c,v 1.177 2016/08/01 10:32:39 schwarze Exp $ */ +/* $OpenBSD: main.c,v 1.178 2016/08/09 15:08:15 schwarze Exp $ */ /* * Copyright (c) 2008-2012 Kristaps Dzonsons <kristaps@bsd.lv> * Copyright (c) 2010-2012, 2014-2016 Ingo Schwarze <schwarze@openbsd.org> @@ -955,7 +955,8 @@ mmsg(enum mandocerr t, enum mandoclevel lvl, { const char *mparse_msg; - fprintf(stderr, "%s: %s:", getprogname(), file); + fprintf(stderr, "%s: %s:", getprogname(), + file == NULL ? "<stdin>" : file); if (line) fprintf(stderr, "%d:%d:", line, col + 1); diff --git a/usr.bin/mandoc/mdoc_validate.c b/usr.bin/mandoc/mdoc_validate.c index 3cb63437c76..41e9920cacc 100644 --- a/usr.bin/mandoc/mdoc_validate.c +++ b/usr.bin/mandoc/mdoc_validate.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mdoc_validate.c,v 1.217 2016/01/08 17:48:04 schwarze Exp $ */ +/* $OpenBSD: mdoc_validate.c,v 1.218 2016/08/09 15:08:15 schwarze Exp $ */ /* * Copyright (c) 2008-2012 Kristaps Dzonsons <kristaps@bsd.lv> * Copyright (c) 2010-2016 Ingo Schwarze <schwarze@openbsd.org> @@ -1764,10 +1764,11 @@ post_sh_head(POST_ARGS) /* The NAME should be first. */ - if (SEC_NAME != sec && SEC_NONE == mdoc->lastnamed) + if (sec != SEC_NAME && mdoc->lastnamed == SEC_NONE) mandoc_vmsg(MANDOCERR_NAMESEC_FIRST, mdoc->parse, - mdoc->last->line, mdoc->last->pos, - "Sh %s", secnames[sec]); + mdoc->last->line, mdoc->last->pos, "Sh %s", + sec == SEC_CUSTOM ? mdoc->last->child->string : + secnames[sec]); /* The SYNOPSIS gets special attention in other areas. */ |