From: Martin Wilck <martin.wilck@suse.com>
To: "bmarzins@redhat.com" <bmarzins@redhat.com>,
"christophe.varoqui@opensvc.com" <christophe.varoqui@opensvc.com>
Cc: "dm-devel@redhat.com" <dm-devel@redhat.com>
Subject: Re: [dm-devel] [PATCH 1/4] libmultipath: don't print garbage keywords
Date: Fri, 21 Oct 2022 07:05:27 +0000 [thread overview]
Message-ID: <d50f3f06e9c0d28c3452d0b51a4d3510c2cd1389.camel@suse.com> (raw)
In-Reply-To: <1665525183-27377-2-git-send-email-bmarzins@redhat.com>
On Tue, 2022-10-11 at 16:53 -0500, Benjamin Marzinski wrote:
> If snprint_keyword() failed to correctly set up sbuf, don't print it.
> Instead, return an error.
>
> Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
Reviewed-by: Martin Wilck <mwilck@suse.com>
> ---
> libmpathutil/parser.c | 8 +++++---
> 1 file changed, 5 insertions(+), 3 deletions(-)
>
> diff --git a/libmpathutil/parser.c b/libmpathutil/parser.c
> index 014d9b83..8d3ac53a 100644
> --- a/libmpathutil/parser.c
> +++ b/libmpathutil/parser.c
> @@ -152,7 +152,7 @@ int
> snprint_keyword(struct strbuf *buff, const char *fmt, struct keyword
> *kw,
> const void *data)
> {
> - int r;
> + int r = 0;
> char *f;
> struct config *conf;
> STRBUF_ON_STACK(sbuf);
> @@ -190,8 +190,10 @@ snprint_keyword(struct strbuf *buff, const char
> *fmt, struct keyword *kw,
> }
> } while (*fmt++);
> out:
> - return __append_strbuf_str(buff, get_strbuf_str(&sbuf),
> - get_strbuf_len(&sbuf));
> + if (r >= 0)
> + r = __append_strbuf_str(buff, get_strbuf_str(&sbuf),
> + get_strbuf_len(&sbuf));
> + return r;
> }
>
> static const char quote_marker[] = { '\0', '"', '\0' };
--
dm-devel mailing list
dm-devel@redhat.com
https://listman.redhat.com/mailman/listinfo/dm-devel
next prev parent reply other threads:[~2022-10-21 7:05 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-10-11 21:52 [dm-devel] [PATCH 0/4] remove dangerous cleanup __attribute__ uses Benjamin Marzinski
2022-10-11 21:53 ` [dm-devel] [PATCH 1/4] libmultipath: don't print garbage keywords Benjamin Marzinski
2022-10-21 7:05 ` Martin Wilck [this message]
2022-10-11 21:53 ` [dm-devel] [PATCH 2/4] libmultipath: avoid STRBUF_ON_STACK with cancellation points Benjamin Marzinski
2022-10-11 21:53 ` [dm-devel] [PATCH 3/4] libmultipath: use regular array for field widths Benjamin Marzinski
2022-10-21 7:04 ` Martin Wilck
2022-10-21 17:51 ` Benjamin Marzinski
2022-10-21 20:12 ` Martin Wilck
2022-10-11 21:53 ` [dm-devel] [PATCH 4/4] libmultipath: avoid cleanup __attribute__ with cancellation points Benjamin Marzinski
2022-10-20 16:03 ` [dm-devel] [PATCH 0/4] remove dangerous cleanup __attribute__ uses Martin Wilck
2022-10-20 22:57 ` Benjamin Marzinski
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=d50f3f06e9c0d28c3452d0b51a4d3510c2cd1389.camel@suse.com \
--to=martin.wilck@suse.com \
--cc=bmarzins@redhat.com \
--cc=christophe.varoqui@opensvc.com \
--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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.