[dm-devel] [PATCH 2/4] libmultipath: Simplify assemble_map()

Martin Wilck mwilck at suse.com
Tue Jun 13 19:32:39 UTC 2017


On Tue, 2017-06-13 at 09:33 -0700, Bart Van Assche wrote:
> Introduce a macro for appending formatted text to the output buffer.
> Eliminate the local variables 'shift' and 'freechar'. Move the
> code for freeing a temporary buffer to the end of the function.
> Handle snprintf() conversion errors. This patch avoids that gcc 7
> reports the following warning:
> 
> dmparser.c:137:20: warning: '__builtin_snprintf' output truncated
> before the last format character [-Wformat-truncation=]
>   snprintf(p, 1, "\n");
>                     ^
> 
> Signed-off-by: Bart Van Assche <bart.vanassche at sandisk.com>
> ---
>  libmultipath/dmparser.c | 67 +++++++++++++++++++++++--------------
> ------------
>  1 file changed, 31 insertions(+), 36 deletions(-)
> 

Reviewed-by: Martin Wilck <mwilck at suse.com>

-- 
Dr. Martin Wilck <mwilck at suse.com>, Tel. +49 (0)911 74053 2107
SUSE Linux GmbH, GF: Felix Imendörffer, Jane Smithard, Graham Norton
HRB 21284 (AG Nürnberg)




More information about the dm-devel mailing list