From: Bart Van Assche <Bart.VanAssche@sandisk.com>
To: "mwilck@suse.com" <mwilck@suse.com>,
"hare@suse.de" <hare@suse.de>,
"christophe.varoqui@opensvc.com" <christophe.varoqui@opensvc.com>
Cc: "dm-devel@redhat.com" <dm-devel@redhat.com>
Subject: Re: [PATCH 1/2] libmultipath: print.c: make sure lines are 0-terminated
Date: Wed, 17 May 2017 14:17:55 +0000 [thread overview]
Message-ID: <1495030674.2945.4.camel@sandisk.com> (raw)
In-Reply-To: <20170517135439.25935-2-mwilck@suse.com>
On Wed, 2017-05-17 at 15:54 +0200, Martin Wilck wrote:
> #define ENDLINE \
> - if (c > line) \
> - line[c - line - 1] = '\n'
> + if (c > line) { \
> + if (c <= line + len - 1) { \
> + *(c - 1) = '\n'; \
> + *c = '\0'; \
> + } else \
> + line[len - 1] = '\0'; \
> + }
Hello Martin,
Please convert ENDLINE from a macro into a function. Functions are
easier to maintain than macros.
Thanks,
Bart.
next prev parent reply other threads:[~2017-05-17 14:17 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-05-17 13:54 [PATCH 0/2] Small multipath fixes Martin Wilck
2017-05-17 13:54 ` [PATCH 1/2] libmultipath: print.c: make sure lines are 0-terminated Martin Wilck
2017-05-17 14:07 ` Johannes Thumshirn
2017-05-17 14:17 ` Bart Van Assche [this message]
2017-05-17 13:54 ` [PATCH 2/2] multipath-tools: fix compilation with gcc < 4.9 Martin Wilck
2017-05-17 14:23 ` Bart Van Assche
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=1495030674.2945.4.camel@sandisk.com \
--to=bart.vanassche@sandisk.com \
--cc=christophe.varoqui@opensvc.com \
--cc=dm-devel@redhat.com \
--cc=hare@suse.de \
--cc=mwilck@suse.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.