diff options
author | 2016-08-09 15:09:27 +0000 | |
---|---|---|
committer | 2016-08-09 15:09:27 +0000 | |
commit | 6737b893e3198eb8acb1647742d46a6c58cf3c30 (patch) | |
tree | bc571e3a78d753c09bfcc10f76add86d4682d542 | |
parent | 83a44904f7c78e291160d641ce52aff6713689bf (diff) | |
download | mandoc-6737b893e3198eb8acb1647742d46a6c58cf3c30.tar.gz mandoc-6737b893e3198eb8acb1647742d46a6c58cf3c30.tar.zst mandoc-6737b893e3198eb8acb1647742d46a6c58cf3c30.zip |
fix printf("%s", NULL);
found while investigating an unrelated bug report from jsg@
-rw-r--r-- | main.c | 5 | ||||
-rw-r--r-- | mdoc_validate.c | 9 |
2 files changed, 8 insertions, 6 deletions
@@ -1,4 +1,4 @@ -/* $Id: main.c,v 1.274 2016/07/19 21:31:55 schwarze Exp $ */ +/* $Id: main.c,v 1.275 2016/08/09 15:09:27 schwarze Exp $ */ /* * Copyright (c) 2008-2012 Kristaps Dzonsons <kristaps@bsd.lv> * Copyright (c) 2010-2012, 2014-2016 Ingo Schwarze <schwarze@openbsd.org> @@ -985,7 +985,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/mdoc_validate.c b/mdoc_validate.c index e369349c..80ce2080 100644 --- a/mdoc_validate.c +++ b/mdoc_validate.c @@ -1,4 +1,4 @@ -/* $Id: mdoc_validate.c,v 1.301 2016/01/08 17:48:09 schwarze Exp $ */ +/* $Id: mdoc_validate.c,v 1.302 2016/08/09 15:09:27 schwarze Exp $ */ /* * Copyright (c) 2008-2012 Kristaps Dzonsons <kristaps@bsd.lv> * Copyright (c) 2010-2016 Ingo Schwarze <schwarze@openbsd.org> @@ -1773,10 +1773,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. */ |