[syslinux] tftp-hpa-0.46 -- a suggestion plus patch

Geert Stappers stappers at stappers.nl
Sat Jan 13 06:31:51 PST 2007


Op 10-01-2007 om 10:23 schreef Peter Breitenlohner:
> When the tftp (-hpa-0.46) client program is terminated by an EOF (i.e.
> Ctrl-D) from the terminal, the program exits without writing a newline and
> consequently the next shell-promt appears on the same line as the
> tftp-prompt.
> 
> The patch below tries to fix this misbehaviour.
> 
> regards
> Peter Breitenlohner <peb at mppmu.mpg.de>
> 
> ======== begin of patch ==================
> diff -ur tftp-hpa-0.46.orig/tftp/main.c tftp-hpa-0.46/tftp/main.c
> --- tftp-hpa-0.46.orig/tftp/main.c	2007-01-09 01:54:30.000000000 +0100
> +++ tftp-hpa-0.46/tftp/main.c	2007-01-09 19:48:49.000000000 +0100
> @@ -352,8 +352,10 @@
> 
>     len = strlen(partial);
>     eline = readline(mprompt);
> -  if (!eline)
> +  if (!eline) {
> +	  printf("\n");
>   	  exit(0);		/* EOF */
> +  }
> 
>     elen = strlen(eline);
> 
> @@ -375,8 +377,10 @@
>     strcpy(line, partial);
>     fputs(mprompt, stdout);
>     if ( fgets(line+len, LBUFLEN-len, stdin) == 0 )
> -	  if ( feof(stdin) )
> +	  if ( feof(stdin) ) {
> +		  printf("\n");
>   		  exit(0);	/* EOF */
> +	  }
>   #endif
>   }
> 
> @@ -770,12 +774,15 @@
>   			line = NULL;
>   		}
>   	        line = readline(prompt);
> -		if ( !line )
> +		if ( !line ) {
> +			printf("\n");
>   			exit(0); /* EOF */
> +		}
>   #else
>   	        fputs(prompt, stdout);
>   		if (fgets(line, LBUFLEN, stdin) == 0) {
>   			if (feof(stdin)) {
> +				printf("\n");
>   				exit(0);
>   			} else {
>   				continue;
> ========= end of patch ===================


Patch looks good.

Please confirm that the posting of the patch to the syslinux mailinglist
should be read as "permission granted to include the modification 
in the main branch of tftp-hpa"



Cheers
Geert Stappers
in another attempt to provoke feedback on patches to this mailinglist.




More information about the Syslinux mailing list