diff options
author | Kristaps Dzonsons <kristaps@bsd.lv> | 2010-12-05 15:49:37 +0000 |
---|---|---|
committer | Kristaps Dzonsons <kristaps@bsd.lv> | 2010-12-05 15:49:37 +0000 |
commit | 17d87274a35b068e7bf8fa10374f640943cf7bb4 (patch) | |
tree | e553f792443dba06fc6803e36479ba67f834c478 | |
parent | 0b4127a628b0da28fe24f16107d14c5255d71a4a (diff) | |
download | mandoc-17d87274a35b068e7bf8fa10374f640943cf7bb4.tar.gz |
Merge schwarze@'s patch to allow uname() to fail without causing an exit.
-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); } |