From: David Edmondson <dme@dme.org>
To: Austin Clements <amdragon@MIT.EDU>
Cc: notmuch@notmuchmail.org
Subject: Re: [RFC][PATCH] notmuch: Workaround to allow ignoring non-void function return.
Date: Thu, 22 Dec 2011 19:25:59 +0000 [thread overview]
Message-ID: <cuny5u4v260.fsf@hotblack-desiato.hh.sledj.net> (raw)
In-Reply-To: <20111222190305.GA324@mit.edu>
[-- Attachment #1: Type: text/plain, Size: 928 bytes --]
On Thu, 22 Dec 2011 14:03:05 -0500, Austin Clements <amdragon@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. */;
}
[-- Attachment #2: Type: application/pgp-signature, Size: 197 bytes --]
next prev parent reply other threads:[~2011-12-22 19:26 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-12-21 21:38 [RFC][PATCH] notmuch: Workaround to allow ignoring non-void function return David Edmondson
2011-12-22 7:03 ` Austin Clements
2011-12-22 7:21 ` David Edmondson
2011-12-22 19:03 ` Austin Clements
2011-12-22 19:25 ` David Edmondson [this message]
2011-12-22 20:04 ` David Edmondson
2011-12-22 20:15 ` Austin Clements
2011-12-22 20:15 ` [PATCH] Properly handle short writes in sigint handlers Austin Clements
2011-12-23 8:10 ` David Edmondson
2011-12-23 12:30 ` Tomi Ollila
2011-12-25 0:38 ` Austin Clements
2011-12-25 0:38 ` Austin Clements
2011-12-23 19:10 ` Dmitry Kurochkin
2012-01-10 11:13 ` David Bremner
2012-01-11 13:04 ` Tomi Ollila
2011-12-22 9:32 ` [RFC][PATCH] notmuch: Workaround to allow ignoring non-void function return Dmitry Kurochkin
2011-12-22 11:24 ` David Edmondson
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://notmuchmail.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=cuny5u4v260.fsf@hotblack-desiato.hh.sledj.net \
--to=dme@dme.org \
--cc=amdragon@MIT.EDU \
--cc=notmuch@notmuchmail.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://yhetil.org/notmuch.git/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).