diff options
-rw-r--r-- | main.c | 2 | ||||
-rw-r--r-- | mandoc.h | 2 | ||||
-rw-r--r-- | mdoc_validate.c | 9 |
3 files changed, 8 insertions, 5 deletions
@@ -170,6 +170,7 @@ static const char * const mandocerrs[MANDOCERR_MAX] = { "request scope close w/none open", "scope already open", "scope open on exit", + "uname(3) system call failed", "macro requires line argument(s)", "macro requires body argument(s)", "macro requires argument(s)", @@ -194,7 +195,6 @@ static const char * const mandocerrs[MANDOCERR_MAX] = { "NOT IMPLEMENTED: .so with absolute path or \"..\"", "no document body", "no document prologue", - "utsname system call failed", "static buffer exhausted", }; @@ -93,6 +93,7 @@ enum mandocerr { MANDOCERR_NOSCOPE, /* no such block is open */ MANDOCERR_SCOPEREP, /* scope already open */ MANDOCERR_SCOPEEXIT, /* scope open on exit */ + MANDOCERR_UNAME, /* uname(3) system call failed */ /* FIXME: merge following with MANDOCERR_ARGCOUNT */ MANDOCERR_NOARGS, /* macro requires line argument(s) */ MANDOCERR_NOBODY, /* macro requires body argument(s) */ @@ -117,7 +118,6 @@ enum mandocerr { MANDOCERR_SOPATH, /* NOT IMPLEMENTED: .so with absolute path or ".." */ MANDOCERR_NODOCBODY, /* no document body */ MANDOCERR_NODOCPROLOG, /* no document prologue */ - MANDOCERR_UTSNAME, /* utsname system call failed */ MANDOCERR_MEM, /* static buffer exhausted */ MANDOCERR_MAX }; diff --git a/mdoc_validate.c b/mdoc_validate.c index b728d52f..fa9f3e13 100644 --- a/mdoc_validate.c +++ b/mdoc_validate.c @@ -2130,14 +2130,17 @@ post_os(POST_ARGS) return(0); } #else /*!OSNAME */ - if (-1 == uname(&utsname)) - return(mdoc_nmsg(mdoc, n, MANDOCERR_UTSNAME)); + if (uname(&utsname)) { + mdoc_nmsg(mdoc, n, MANDOCERR_UNAME); + mdoc->meta.os = mandoc_strdup("UNKNOWN"); + return(post_prol(mdoc)); + } if (strlcat(buf, utsname.sysname, BUFSIZ) >= BUFSIZ) { mdoc_nmsg(mdoc, n, MANDOCERR_MEM); return(0); } - if (strlcat(buf, " ", 64) >= BUFSIZ) { + if (strlcat(buf, " ", BUFSIZ) >= BUFSIZ) { mdoc_nmsg(mdoc, n, MANDOCERR_MEM); return(0); } |