[RFC][PATCH] notmuch: Workaround to allow ignoring non-void function return.
David Edmondson
dme at dme.org
Thu Dec 22 11:25:59 PST 2011
On Thu, 22 Dec 2011 14:03:05 -0500, Austin Clements <amdragon at MIT.EDU> 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. */;
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: not available
URL: <http://notmuchmail.org/pipermail/notmuch/attachments/20111222/c2441045/attachment.pgp>
More information about the notmuch
mailing list