From e8e581bf256b8c0fbd430935af79fa0e8ee570a1 Mon Sep 17 00:00:00 2001 From: Zbigniew Jędrzejewski-Szmek Date: Mon, 15 Apr 2013 22:25:58 -0400 Subject: Report about syntax errors with metadata The information about the unit for which files are being parsed is passed all the way down. This way messages land in the journal with proper UNIT=... or USER_UNIT=... attribution. 'systemctl status' and 'journalctl -u' not displaying those messages has been a source of confusion for users, since the journal entry for a misspelt setting was often logged quite a bit earlier than the failure to start a unit. Based-on-a-patch-by: Oleksii Shevchuk --- src/shared/install.c | 39 ++++++++++++++++++++------------------- 1 file changed, 20 insertions(+), 19 deletions(-) (limited to 'src/shared/install.c') diff --git a/src/shared/install.c b/src/shared/install.c index 71e04335ef..75d6ca3619 100644 --- a/src/shared/install.c +++ b/src/shared/install.c @@ -921,15 +921,15 @@ static int install_info_add_auto( return install_info_add(c, name_or_path, NULL); } -static int config_parse_also( - const char *filename, - unsigned line, - const char *section, - const char *lvalue, - int ltype, - const char *rvalue, - void *data, - void *userdata) { +static int config_parse_also(const char *unit, + const char *filename, + unsigned line, + const char *section, + const char *lvalue, + int ltype, + const char *rvalue, + void *data, + void *userdata) { char *w; size_t l; @@ -956,15 +956,15 @@ static int config_parse_also( return 0; } -static int config_parse_user( - const char *filename, - unsigned line, - const char *section, - const char *lvalue, - int ltype, - const char *rvalue, - void *data, - void *userdata) { +static int config_parse_user(const char *unit, + const char *filename, + unsigned line, + const char *section, + const char *lvalue, + int ltype, + const char *rvalue, + void *data, + void *userdata) { InstallInfo *i = data; char* printed; @@ -1016,7 +1016,8 @@ static int unit_file_load( return -ENOMEM; } - r = config_parse(path, f, NULL, config_item_table_lookup, (void*) items, true, info); + r = config_parse(NULL, path, f, NULL, + config_item_table_lookup, (void*) items, true, info); if (r < 0) return r; -- cgit v1.2.3-54-g00ecf