diff options
-rw-r--r-- | gnu/usr.bin/man/man/man.c | 11 | ||||
-rw-r--r-- | gnu/usr.bin/man/man/manpath.c | 17 |
2 files changed, 16 insertions, 12 deletions
diff --git a/gnu/usr.bin/man/man/man.c b/gnu/usr.bin/man/man/man.c index fdfab5a..4452fc4 100644 --- a/gnu/usr.bin/man/man/man.c +++ b/gnu/usr.bin/man/man/man.c @@ -757,12 +757,12 @@ ultimate_source (name, path) next: if ((fp = fopen (ult, "r")) == NULL) - return buf; - - if (fgets (buf, BUFSIZ, fp) == NULL) return ult; - if (strlen (buf) < 5) + end = fgets (buf, BUFSIZ, fp); + fclose(fp); + + if (!end || strlen (buf) < 5) return ult; beg = buf; @@ -948,6 +948,7 @@ make_roff_command (file) { cp = line; fgets (line, BUFSIZ, fp); + fclose(fp); if (*cp++ == '\'' && *cp++ == '\\' && *cp++ == '"' && *cp++ == ' ') { if (debug) @@ -955,8 +956,6 @@ make_roff_command (file) status = parse_roff_directive (cp, file, buf, sizeof(buf)); - fclose (fp); - if (status == 0) return buf; diff --git a/gnu/usr.bin/man/man/manpath.c b/gnu/usr.bin/man/man/manpath.c index 294ffaf..cdc370c 100644 --- a/gnu/usr.bin/man/man/manpath.c +++ b/gnu/usr.bin/man/man/manpath.c @@ -202,9 +202,11 @@ get_dirlist () if (!strncmp ("MANDATORY_MANPATH", bp, 17)) { - if ((p = strchr (bp, ' ')) == NULL) - if ((p = strchr (bp, '\t')) == NULL) - return -1; + if ((p = strchr (bp, ' ')) == NULL && + (p = strchr (bp, '\t')) == NULL) { + fclose(config); + return -1; + } bp = p; @@ -224,9 +226,11 @@ get_dirlist () } else if (!strncmp ("MANPATH_MAP", bp, 11)) { - if ((p = strchr (bp, ' ')) == NULL) - if ((p = strchr (bp, '\t')) == NULL) - return -1; + if ((p = strchr (bp, ' ')) == NULL && + (p = strchr (bp, '\t')) == NULL) { + fclose(config); + return -1; + } bp = p; @@ -259,6 +263,7 @@ get_dirlist () dlp++; } + fclose(config); dlp->bin[0] = '\0'; dlp->mandir[0] = '\0'; dlp->mandatory = 0; |