Diego Nieto Cid, le dim. 28 sept. 2025 21:38:35 +0100, a ecrit:
> On Sun, Sep 28, 2025 at 09:24:58PM +0200, Samuel Thibault wrote:
> > [email protected], le dim. 28 sept. 2025 19:17:16 +0100, a ecrit:
> > > -      write (fd, s, t - s);
> > > +      err = write (fd, s, t - s);
> > > +      assert_backtrace (err != -1);
> > 
> > You actually want to check that the return value is the number of bytes
> > that you have passed, otherwise we had a short-write. That'd be
> > surprising for a tty (normally it would just block), but better be safe
> > than risk losing characters.
> > 
> 
> Is 'assert_backtrace (err != (t - s))' enough?

Yes.

> Or should I implement a
> 'full_write' which loops until all byte are written?

In the cases at stake, you won't get a short write.

Samuel

Reply via email to