[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20140305185046.GA6708@bender.morinfr.org>
Date: Wed, 5 Mar 2014 19:50:47 +0100
From: Guillaume Morin <guillaume@...infr.org>
To: Colin King <colin.king@...onical.com>
Cc: Stanislav Kinsbursky <skinsbursky@...allels.com>,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH] selftests: ipc: handle msgget failure return correctly
On 05 Mar 17:51, Colin King wrote:
> From: Colin Ian King <colin.king@...onical.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@...onical.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@...infr.org>
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists