From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from krisdoz.my.domain (schwarze@localhost [127.0.0.1]) by krisdoz.my.domain (8.14.5/8.14.5) with ESMTP id s6IEkQIF025683 for ; Fri, 18 Jul 2014 10:46:26 -0400 (EDT) Received: (from schwarze@localhost) by krisdoz.my.domain (8.14.5/8.14.3/Submit) id s6IEkPX3005469; Fri, 18 Jul 2014 10:46:25 -0400 (EDT) Date: Fri, 18 Jul 2014 10:46:25 -0400 (EDT) Message-Id: <201407181446.s6IEkPX3005469@krisdoz.my.domain> X-Mailinglist: mdocml-source Reply-To: source@mdocml.bsd.lv MIME-Version: 1.0 From: schwarze@mdocml.bsd.lv To: source@mdocml.bsd.lv Subject: mdocml: When the MAN_DIR/manpath.conf configuration file does not exist X-Mailer: activitymail 1.26, http://search.cpan.org/dist/activitymail/ Content-Type: text/plain; charset=utf-8 Log Message: ----------- When the MAN_DIR/manpath.conf configuration file does not exist or is empty, log the problem, hand the pg_error_internal() error page to the client, and exit(3) in a controlled way instead of stumbling on and segfaulting later. Patch from Sebastien Marie , messages tweaked by me. Modified Files: -------------- mdocml: cgi.c Revision Data ------------- Index: cgi.c =================================================================== RCS file: /usr/vhosts/mdocml.bsd.lv/cvs/mdocml/cgi.c,v retrieving revision 1.73 retrieving revision 1.74 diff -Lcgi.c -Lcgi.c -u -p -r1.73 -r1.74 --- cgi.c +++ cgi.c @@ -970,8 +970,12 @@ pathgen(struct req *req) char *dp; size_t dpsz; - if (NULL == (fp = fopen("manpath.conf", "r"))) - return; + if (NULL == (fp = fopen("manpath.conf", "r"))) { + fprintf(stderr, "%s/manpath.conf: %s\n", + MAN_DIR, strerror(errno)); + pg_error_internal(); + exit(EXIT_FAILURE); + } while (NULL != (dp = fgetln(fp, &dpsz))) { if ('\n' == dp[dpsz - 1]) @@ -979,5 +983,11 @@ pathgen(struct req *req) req->p = mandoc_realloc(req->p, (req->psz + 1) * sizeof(char *)); req->p[req->psz++] = mandoc_strndup(dp, dpsz); + } + + if ( req->p == NULL ) { + fprintf(stderr, "%s/manpath.conf is empty\n", MAN_DIR); + pg_error_internal(); + exit(EXIT_FAILURE); } } -- To unsubscribe send an email to source+unsubscribe@mdocml.bsd.lv