Subject: bug#44320: [PATH] [27.1] Make sure send-string-to-terminal send all contents

From: Eli Zaretskii <[email-masked]>
Date: Mon, 02 Nov 2020 20:35:57 +0200

> From: Andreas Schwab <[email-masked]>
> Cc: [email-masked],  [email-masked],  [email-masked],
>   [email-masked]
> Date: Mon, 02 Nov 2020 19:22:21 +0100
> 
> On Nov 02 2020, Eli Zaretskii wrote:
> 
> > But that means 'fwrite' could return zero, if its very first call to
> > 'write' got interrupted, no?
> 
> No.  When an error occurs, it returns EOF.

Is EINTR considered an error for this purpose?  If not, what exactly
is considered an error?  I don't see this clearly documented, so it
could be something we cannot rely on.  In fact, I don't even see in
portable documentation that it will return EOF upon errors, I only see
that the error indication for the stream shall be set and errno shall
be set.

In short, it sounds like calling fwrite in a loop will only work by
sheer luck.