From fd51c0c39017f44ceec4229f86eaa7c8e193ebdc Mon Sep 17 00:00:00 2001 From: Steve Dickson Date: Mon, 17 Aug 2009 08:50:04 -0400 Subject: [PATCH] Cleaned up parsing errors to hopeful be more precise Also had mount_config_init() call xlog_open() so the program name is set on xlog() calls. Signed-off-by: Steve Dickson --- support/nfs/conffile.c | 10 +++++----- utils/mount/mount.c | 2 +- utils/mount/mount_config.h | 7 ++++--- 3 files changed, 10 insertions(+), 9 deletions(-) diff --git a/support/nfs/conffile.c b/support/nfs/conffile.c index 6bf4237..b277c2a 100644 --- a/support/nfs/conffile.c +++ b/support/nfs/conffile.c @@ -244,7 +244,7 @@ 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; @@ -274,7 +274,7 @@ conf_parse_line(int trans, char *line, size_t sz) while (*ptr && *ptr != '"') ptr++; if (*ptr == '\0') { - xlog_warn("conf_parse_line: line %d:" + xlog_warn("config file error: line %d: " "non-matched '\"', ignoring until next section", ln); } else { *ptr = '\0'; @@ -290,8 +290,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 +321,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; } diff --git a/utils/mount/mount.c b/utils/mount/mount.c index 909fedf..355df79 100644 --- a/utils/mount/mount.c +++ b/utils/mount/mount.c @@ -475,7 +475,7 @@ int main(int argc, char *argv[]) spec = argv[1]; mount_point = argv[2]; - mount_config_init(); + mount_config_init(progname); argv[2] = argv[0]; /* so that getopt error messages are correct */ while ((c = getopt_long(argc - 2, argv + 2, "rvVwfno:hs", diff --git a/utils/mount/mount_config.h b/utils/mount/mount_config.h index 2af9f9d..9a885a9 100644 --- a/utils/mount/mount_config.h +++ b/utils/mount/mount_config.h @@ -16,14 +16,15 @@ * */ -inline void mount_config_init(void); +inline void mount_config_init(char *); #ifdef MOUNT_CONFIG #include "conffile.h" extern char *conf_get_mntopts(char *, char *, char *); -inline void mount_config_init() +inline void mount_config_init(char *program) { + xlog_open(program); /* * Read the the default mount options */ @@ -36,7 +37,7 @@ inline char *mount_config_opts(char *spec, } #else /* MOUNT_CONFIG */ -inline void mount_config_init() { } +inline void mount_config_init(char *program) { } inline char *mount_config_opts(char *spec, char *mount_point, char *mount_opts) -- 2.39.5