]> git.decadent.org.uk Git - nfs-utils.git/blobdiff - support/nfs/conffile.c
Removed a warning from conffile.c
[nfs-utils.git] / support / nfs / conffile.c
index 6bf423728a5d02cb8e74a20d565fe177d1979f4f..fa0dc6b792da8bb5fc8a6e4f8d461e6556002d39 100644 (file)
@@ -49,7 +49,7 @@
 #include "conffile.h"
 #include "xlog.h"
 
-static void conf_load_defaults (int);
+static void conf_load_defaults(void);
 static int conf_set(int , char *, char *, char *, 
        char *, int , int );
 
@@ -212,7 +212,7 @@ conf_parse_line(int trans, char *line, size_t sz)
 {
        char *val, *ptr;
        size_t i;
-       int j;
+       size_t j;
        static char *section = 0;
        static char *arg = 0;
        static int ln = 0;
@@ -244,13 +244,14 @@ conf_parse_line(int trans, char *line, size_t sz)
                if (section)
                        free(section);
                if (i == sz) {
-                       xlog_warn("conf_parse_line: %d:"
+                       xlog_warn("config file error: line %d: "
                                "non-matched ']', ignoring until next section", ln);
                        section = 0;
                        return;
                }
                /* Strip off any blanks before ']' */
                val = line;
+               j=0;
                while (*val && !isblank(*val)) 
                        val++, j++;
                if (*val)
@@ -271,10 +272,10 @@ conf_parse_line(int trans, char *line, size_t sz)
                if (ptr == NULL)
                        return;
                line = ++ptr;
-               while (*ptr && *ptr != '"')
+               while (*ptr && *ptr != '"' && *ptr != ']')
                        ptr++;
-               if (*ptr == '\0') {
-                       xlog_warn("conf_parse_line: line %d:"
+               if (*ptr == '\0' || *ptr == ']') {
+                       xlog_warn("config file error: line %d: "
                                "non-matched '\"', ignoring until next section", ln);
                }  else {
                        *ptr = '\0';
@@ -290,8 +291,8 @@ conf_parse_line(int trans, char *line, size_t sz)
                if (line[i] == '=') {
                        /* If no section, we are ignoring the lines.  */
                        if (!section) {
-                               xlog_warn("conf_parse_line: %d: ignoring line due to no section", 
-                                       ln);
+                       xlog_warn("config file error: line %d: "
+                               "ignoring line due to no section", ln);
                                return;
                        }
                        line[strcspn (line, " \t=")] = '\0';
@@ -321,7 +322,7 @@ conf_parse_line(int trans, char *line, size_t sz)
        /* Other non-empty lines are weird.  */
        i = strspn(line, " \t");
        if (line[i])
-               xlog_warn("conf_parse_line: %d: syntax error", ln);
+               xlog_warn("config file error: line %d:", ln);
 
        return;
 }
@@ -353,7 +354,7 @@ conf_parse(int trans, char *buf, size_t sz)
 }
 
 static void
-conf_load_defaults(int tr)
+conf_load_defaults(void)
 {
        /* No defaults */
        return;
@@ -412,7 +413,7 @@ conf_reinit(void)
                trans = conf_begin();
 
        /* Load default configuration values.  */
-       conf_load_defaults(trans);
+       conf_load_defaults();
 
        /* Free potential existing configuration.  */
        if (conf_addr) {