[PATCH] makedumpfile: --dump-dmesg characters printing fix

Atsushi Kumagai kumagai-atsushi at mxc.nes.nec.co.jp
Thu Jan 16 03:08:06 EST 2014


On 2014/01/14 17:58:35, WANG Chao <chaowang at redhat.com> wrote:
> To keep the output of makedumpfile --dump-dmesg being consistent with
> dmesg utility, this patch introduces two changes:
> 
> 1. If a character is non-printable, print its hex value ("\\x%02x")
> 2. No special handling for "\n" ("\n" -> ".")
> 
> Signed-off-by: WANG Chao <chaowang at redhat.com>

Thanks, I was just about to fix it !
I'll merge this patch into v1.5.6.


Atsushi Kumagai

> ---
>  makedumpfile.c | 6 ++----
>  1 file changed, 2 insertions(+), 4 deletions(-)
> 
> diff --git a/makedumpfile.c b/makedumpfile.c
> index ef08d91..73467ab 100644
> --- a/makedumpfile.c
> +++ b/makedumpfile.c
> @@ -3848,12 +3848,10 @@ dump_log_entry(char *logptr, int fp)
>  	sprintf(buf, "[%5lld.%06ld] ", nanos, rem/1000);
>  
>  	for (i = 0, p = msg; i < text_len; i++, p++) {
> -		if (*p == '\n')
> -			sprintf(buf, "%s.", buf);
> -		else if (isprint(*p) || isspace(*p))
> +		if (isprint(*p) || isspace(*p))
>  			sprintf(buf, "%s%c", buf, *p);
>  		else
> -			sprintf(buf, "%s.", buf);
> +			sprintf(buf, "%s\\x%02x", buf, *p);
>  	}
>  
>  	sprintf(buf, "%s\n", buf);
> -- 
> 1.8.4.2
> 
> 



More information about the kexec mailing list