On Thu, 22 Dec 2011 14:03:05 -0500, Austin Clements <[email protected]> wrote: > > In general I agree, but what would we do if writing an error message to > > stderr fails? > > This was discussed on IRC, but calls to write(2) should never be bare. > I believe it's marked warn_unused_result not because libc is so > concerned with people checking for error returns (otherwise all sorts > of things would be marked warn_unused_result) but because even a > successful write can be a short write. Hence, not checking the result > is a bug, even if you don't care about errors.
As I said, the principle is sound. What would do in this specific case?
static void
handle_sigint (unused (int sig))
{
static char msg[] = "Stopping... \n";
write(2, msg, sizeof(msg)-1);
interrupted = 1;
}
Just this?
if (write(2, msg, sizeof(msg)-1) {
/* Appease the compiler. */;
}
pgpD0SkqZ7Gwx.pgp
Description: PGP signature
_______________________________________________ notmuch mailing list [email protected] http://notmuchmail.org/mailman/listinfo/notmuch
