man: fix breakage: must not die on lines with < 2 tokens
authorDenis Vlasenko <vda.linux@googlemail.com>
Sun, 20 Jul 2008 17:43:21 +0000 (17:43 -0000)
committerDenis Vlasenko <vda.linux@googlemail.com>
Sun, 20 Jul 2008 17:43:21 +0000 (17:43 -0000)
miscutils/man.c

index 75af3d7753f96b81afc8ee7a18058ac6f1fd24f7..7ef5941a1fa066429fcc4360dcba6cb47d48c35c 100644 (file)
@@ -106,13 +106,15 @@ int man_main(int argc UNUSED_PARAM, char **argv)
        if (parser) {
                /* go through man configuration file and search relevant paths, sections */
                char *token[2];
-               while (config_read(parser, token, 2, 2, "# \t", PARSE_LAST_IS_GREEDY)) {
+               while (config_read(parser, token, 2, 0, "# \t", PARSE_LAST_IS_GREEDY)) {
+                       if (!token[1])
+                               continue;
                        if (strcmp("MANPATH", token[0]) == 0) {
-                               man_path_list = xrealloc_vector(man_path_list, 4, count_mp);
                                man_path_list[count_mp] = xstrdup(token[1]);
                                count_mp++;
                                /* man_path_list is NULL terminated */
                                man_path_list[count_mp] = NULL;
+                               man_path_list = xrealloc_vector(man_path_list, 4, count_mp);
                        }
                        if (strcmp("MANSECT", token[0]) == 0) {
                                free(sec_list);