Linux Device Mapper development
 help / color / mirror / Atom feed
From: Sebastian Herbszt <herbszt@gmx.de>
To: Bart Van Assche <bvanassche@acm.org>
Cc: device-mapper development <dm-devel@redhat.com>
Subject: Re: [PATCH 4/5] libmultipath: Print line number for which parsing failed
Date: Thu, 24 Jul 2014 16:44:04 +0200	[thread overview]
Message-ID: <20140724164404.000073d6@localhost> (raw)
In-Reply-To: <53C918F5.2050703@acm.org>

Bart Van Assche wrote:
> Make it easier to figure out which line contains a syntax error
> by printing the line number and the offending line itself.
> 
> Signed-off-by: Bart Van Assche <bvanassche@acm.org>
> ---
>  libmultipath/parser.c | 11 ++++++++---
>  1 file changed, 8 insertions(+), 3 deletions(-)
> 
> diff --git a/libmultipath/parser.c b/libmultipath/parser.c
> index b7bdfcc..d8673bc 100644
> --- a/libmultipath/parser.c
> +++ b/libmultipath/parser.c
> @@ -460,7 +460,7 @@ int
>  process_stream(vector keywords)
>  {
>  	int i;
> -	int r = 0;
> +	int r = 0, t;
>  	struct keyword *keyword;
>  	char *str;
>  	char *buf;
> @@ -501,8 +501,13 @@ process_stream(vector keywords)
>  						free_strvec(strvec);
>  						goto out;
>  				}
> -				if (keyword->handler)
> -					r += (*keyword->handler) (strvec);
> +				if (keyword->handler) {
> +					t = (*keyword->handler) (strvec);
> +					r += t;
> +					if (t)
> +						condlog(1, "multipath.conf +%d parsing failed: %s",
> +							line_nr, buf);
> +				}
>  
>  				if (keyword->sub) {
>  					kw_level++;

Further below
condlog(1, "multipath.conf +%d, invalid keyword: %s", line_nr, str);
is used, so maybe also add a comma after the line number too.

Sebastian

  reply	other threads:[~2014-07-24 14:44 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-07-18 12:52 [PATCH 0/5] Five small multipath-tools patches Bart Van Assche
2014-07-18 12:52 ` [PATCH 1/5] ALUA prioritizer: Remove an unused variable Bart Van Assche
2014-07-24 14:37   ` Sebastian Herbszt
2014-07-18 12:53 ` [PATCH 2/5] libmultipath: Simplify read_line() Bart Van Assche
2014-07-18 12:53 ` [PATCH 3/5] libmultipath: Zero-terminate sysfs_attr_get_value() result Bart Van Assche
2014-07-18 12:54 ` [PATCH 4/5] libmultipath: Print line number for which parsing failed Bart Van Assche
2014-07-24 14:44   ` Sebastian Herbszt [this message]
2014-07-25  9:15     ` Christophe Varoqui
2014-07-18 12:54 ` [PATCH 5/5] libmultipath: Accept "*" as a valid regular expression Bart Van Assche
2014-07-24 14:55   ` Sebastian Herbszt
2014-07-24 16:34     ` Bryn M. Reeves
2014-07-25  9:10       ` Christophe Varoqui
2014-07-24  8:29 ` [PATCH 0/5] Five small multipath-tools patches Christophe Varoqui

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20140724164404.000073d6@localhost \
    --to=herbszt@gmx.de \
    --cc=bvanassche@acm.org \
    --cc=dm-devel@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox