From: Peter Maydell <peter.maydell@linaro.org>
To: Alon Levy <alevy@redhat.com>
Cc: qemu-trivial@nongnu.org, qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH 1/5] oslib-posix: add qemu_pipe_non_block
Date: Tue, 4 Jun 2013 21:48:59 +0100 [thread overview]
Message-ID: <CAFEAcA9r4iM-a-v4GhNzN53za5iToH5r3F-EEENRL5J5bziUQA@mail.gmail.com> (raw)
In-Reply-To: <1370377419-31788-1-git-send-email-alevy@redhat.com>
On 4 June 2013 21:23, Alon Levy <alevy@redhat.com> wrote:
>
> +int qemu_pipe_non_block(int pipefd[2])
> +{
> + int ret;
> +
> + ret = qemu_pipe(pipefd);
> + if (ret) {
> + return ret;
> + }
> + if (fcntl(card->pipe[0], F_SETFL, O_NONBLOCK) == -1) {
> + return -errno;
> + }
> + if (fcntl(card->pipe[1], F_SETFL, O_NONBLOCK) == -1) {
> + return -errno;
> + }
qemu_set_nonblock(card->pipe[0]);
qemu_set_nonblock(card->pipe[1]);
> + if (fcntl(card->pipe[0], F_SETOWN, getpid()) == -1) {
> + return -errno;
> + }
You should either just trust that the fcntl() succeeds
(as we do in qemu_set_block() and friends), or you need
to close the pipe fds on failure here.
> +}
You've forgotten to return anything at the end of the function.
(surprised the compiler didn't pick that up, maybe it's
one of the warnings that needs optimimisation turned on).
thanks
-- PMM
next prev parent reply other threads:[~2013-06-04 20:49 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-06-04 20:23 [Qemu-devel] [PATCH 1/5] oslib-posix: add qemu_pipe_non_block Alon Levy
2013-06-04 20:23 ` [Qemu-devel] [PATCH 2/5] use qemu_pipe_non_block Alon Levy
2013-06-04 20:47 ` Paolo Bonzini
2013-06-04 20:59 ` Alon Levy
2013-06-04 21:08 ` Peter Maydell
2013-06-04 20:50 ` Peter Maydell
2013-06-04 20:56 ` Alon Levy
2013-06-04 20:23 ` [Qemu-devel] [PATCH 3/5] libcacard/vscclient: fix leakage of socket on error paths Alon Levy
2013-06-04 20:55 ` Peter Maydell
2013-06-12 12:09 ` [Qemu-devel] [Qemu-trivial] " Michael Tokarev
2013-06-04 20:23 ` [Qemu-devel] [PATCH 4/5] libcacard/vreader.c: fix possible NULL dereference Alon Levy
2013-06-04 21:06 ` Peter Maydell
2013-06-04 20:23 ` [Qemu-devel] [PATCH 5/5] libcacard/vscclient.c: fix use of uninitialized variable Alon Levy
2013-06-04 21:12 ` Peter Maydell
2013-06-04 20:48 ` Peter Maydell [this message]
2013-06-04 21:11 ` [Qemu-devel] [PATCH 1/5] oslib-posix: add qemu_pipe_non_block Eric Blake
2013-06-04 21:41 ` Alon Levy
2013-06-05 19:43 ` [Qemu-devel] [Qemu-trivial] " Michael Tokarev
2013-06-12 9:38 ` Michael Tokarev
2013-06-12 11:21 ` Alon Levy
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=CAFEAcA9r4iM-a-v4GhNzN53za5iToH5r3F-EEENRL5J5bziUQA@mail.gmail.com \
--to=peter.maydell@linaro.org \
--cc=alevy@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=qemu-trivial@nongnu.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.
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 NNTP newsgroup(s).