[U-Boot-Users] [PATCH] fixed tftp error message output

Wolfgang Denk wd at denx.de
Sat Jul 19 21:28:14 CEST 2003


Dear Andreas,

in message <1058582070.943.37.camel at localhost> you wrote:
> 
> This patch fixes tftp error message output, i.e. does not print the last
> two bytes which contain garbage (at least for my setup, I hope this is
> not a tftp server issue).

Is there a way to provoke such an error, so we can test this?

>  	case TFTP_ERROR:
> -		printf ("\nTFTP error: '%s' (%d)\n",
> -					pkt + 2, ntohs(*(ushort *)pkt));
> +		printf ("\nTFTP error %d: ", ntohs(*(ushort *)pkt));
> +		pkt += 2;
> +		len -= 2;
> +		while (len--)
> +			printf("%c", *pkt++);
> +		printf("\n");
> +

Patch rejected. What happens if "len" turns out to be zero?
Also, the code is unnecessary complex.

If there really is such a problem, this should do as well (and  maybe
better):

	printf ("\nTFTP error: '%.*s' (%d)\n",
		len - 2,
		pkt + 2,
		ntohs(*(ushort *)pkt) );

Can you please test this (and eventually re-submit the patch) ?

Thanks.

Best regards,

Wolfgang Denk

-- 
Software Engineering:  Embedded and Realtime Systems,  Embedded Linux
Phone: (+49)-8142-4596-87  Fax: (+49)-8142-4596-88  Email: wd at denx.de
A memorandum is written not to inform the reader, but to protect  the
writer.                                               -- Dean Acheson




More information about the U-Boot mailing list