From: Guillaume Morin <guillaume@morinfr.org>
To: Colin King <colin.king@canonical.com>
Cc: Stanislav Kinsbursky <skinsbursky@parallels.com>,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] selftests: ipc: handle msgget failure return correctly
Date: Wed, 5 Mar 2014 19:50:47 +0100 [thread overview]
Message-ID: <20140305185046.GA6708@bender.morinfr.org> (raw)
In-Reply-To: <1394041873-4220-1-git-send-email-colin.king@canonical.com>
On 05 Mar 17:51, Colin King wrote:
> From: Colin Ian King <colin.king@canonical.com>
>
> A failed msgget causes the test to return an uninitialised value
> in ret. Assign ret to -errno on error exit.
>
> Signed-off-by: Colin Ian King <colin.king@canonical.com>
> ---
> tools/testing/selftests/ipc/msgque.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/tools/testing/selftests/ipc/msgque.c b/tools/testing/selftests/ipc/msgque.c
> index d664182..be8f294 100644
> --- a/tools/testing/selftests/ipc/msgque.c
> +++ b/tools/testing/selftests/ipc/msgque.c
> @@ -202,6 +202,7 @@ int main(int argc, char **argv)
> msgque.msq_id = msgget(msgque.key, IPC_CREAT | IPC_EXCL | 0666);
> if (msgque.msq_id == -1) {
> printf("Can't create queue\n");
> + err = -errno;
> goto err_out;
> }
>
> --
Maybe I am nitpicking here but printf() could modify errno, so you might
as well save it before printf() is called.
--
Guillaume Morin <guillaume@morinfr.org>
next prev parent reply other threads:[~2014-03-05 18:51 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-03-05 17:51 [PATCH] selftests: ipc: handle msgget failure return correctly Colin King
2014-03-05 18:13 ` Davidlohr Bueso
2014-03-05 18:50 ` Guillaume Morin [this message]
2014-03-05 18:58 ` Colin Ian King
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=20140305185046.GA6708@bender.morinfr.org \
--to=guillaume@morinfr.org \
--cc=colin.king@canonical.com \
--cc=linux-kernel@vger.kernel.org \
--cc=skinsbursky@parallels.com \
/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