Re: [PATCH 1/2] login: Write cat output to stdout

Samuel Thibault <[email protected]> Mon, 22 Jun 2026 01:49:08 +0200
Newsgroups gmane.os.hurd.bugs
Organization I am not organized
Message-ID <ajh4dO_JwkeQ_E7s@end>
Applied, thanks!

Bradley Morgan, le dim. 21 juin 2026 18:18:54 +0000, a ecrit:
> cat is used to display /etc/nologin and the MOTD, and its comment says it writes to standard output. It actually wrote to file descriptor 0, which is the caller's standard input.
> 
> Write to STDOUT_FILENO instead.
> 
> Signed-off-by: Bradley Morgan <[email protected]>
> ---
>  utils/login.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/utils/login.c b/utils/login.c
> index d348c6db..bef1185f 100644
> --- a/utils/login.c
> +++ b/utils/login.c
> @@ -140,7 +140,7 @@ cat (mach_port_t node, char *str)
>  	  break;
>  	else
>  	  {
> -	    ssize_t err2 = write (0, data, data_len);
> +	    ssize_t err2 = write (STDOUT_FILENO, data, data_len);
>  	    assert_backtrace (err2 == data_len);
>  	    if (data != buf)
>  	      munmap (data, data_len);
> -- 
> 2.53.0
> 
> 

-- 
Samuel
"And the next time you consider complaining that running Lucid Emacs
19.05 via NFS from a remote Linux machine in Paraguay doesn't seem to
get the background colors right, you'll know who to thank."
(By Matt Welsh)