diff options
author | Ingo Schwarze <schwarze@openbsd.org> | 2021-10-04 14:19:14 +0000 |
---|---|---|
committer | Ingo Schwarze <schwarze@openbsd.org> | 2021-10-04 14:19:14 +0000 |
commit | d9e36737be633b363b9bcd7279d111cf27e49f8a (patch) | |
tree | 395491bb1f5bcaac41cc22ed6fd87aa0c4a55459 /mdoc_validate.c | |
parent | 2370f894fe9bfb6eec392f2caf8d72b24d9d920b (diff) | |
download | mandoc-d9e36737be633b363b9bcd7279d111cf27e49f8a.tar.gz |
store the operating system name obtained from uname(3) in the adequate
struct together with similar state date rather than in a function-scope
static variable, such that it can be free(3)d in roff_man_free();
no functional change
Diffstat (limited to 'mdoc_validate.c')
-rw-r--r-- | mdoc_validate.c | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/mdoc_validate.c b/mdoc_validate.c index 170ae0bf..11b48a2f 100644 --- a/mdoc_validate.c +++ b/mdoc_validate.c @@ -1,6 +1,6 @@ /* $Id$ */ /* - * Copyright (c) 2010-2020 Ingo Schwarze <schwarze@openbsd.org> + * Copyright (c) 2010-2021 Ingo Schwarze <schwarze@openbsd.org> * Copyright (c) 2008-2012 Kristaps Dzonsons <kristaps@bsd.lv> * Copyright (c) 2010 Joerg Sonnenberger <joerg@netbsd.org> * @@ -2872,7 +2872,6 @@ post_os(POST_ARGS) { #ifndef OSNAME struct utsname utsname; - static char *defbuf; #endif struct roff_node *n; @@ -2909,15 +2908,15 @@ post_os(POST_ARGS) #ifdef OSNAME mdoc->meta.os = mandoc_strdup(OSNAME); #else /*!OSNAME */ - if (defbuf == NULL) { + if (mdoc->os_r == NULL) { if (uname(&utsname) == -1) { mandoc_msg(MANDOCERR_OS_UNAME, n->line, n->pos, "Os"); - defbuf = mandoc_strdup("UNKNOWN"); + mdoc->os_r = mandoc_strdup("UNKNOWN"); } else - mandoc_asprintf(&defbuf, "%s %s", + mandoc_asprintf(&mdoc->os_r, "%s %s", utsname.sysname, utsname.release); } - mdoc->meta.os = mandoc_strdup(defbuf); + mdoc->meta.os = mandoc_strdup(mdoc->os_r); #endif /*!OSNAME*/ out: |