Re: [PATCH 1/2] libmultipath: print.c: make sure lines are 0-terminated

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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.

--
dm-devel mailing list
dm-devel@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/dm-devel



[Index of Archives]     [DM Crypt]     [Fedora Desktop]     [ATA RAID]     [Fedora Marketing]     [Fedora Packaging]     [Fedora SELinux]     [Yosemite Discussion]     [KDE Users]     [Fedora Docs]

  Powered by Linux