* [PATCH] selftests: ipc: handle msgget failure return correctly
@ 2014-03-05 17:51 Colin King
2014-03-05 18:13 ` Davidlohr Bueso
2014-03-05 18:50 ` Guillaume Morin
0 siblings, 2 replies; 4+ messages in thread
From: Colin King @ 2014-03-05 17:51 UTC (permalink / raw)
To: Stanislav Kinsbursky, linux-kernel
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;
}
--
1.9.0
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] selftests: ipc: handle msgget failure return correctly
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
1 sibling, 0 replies; 4+ messages in thread
From: Davidlohr Bueso @ 2014-03-05 18:13 UTC (permalink / raw)
To: Colin King; +Cc: Stanislav Kinsbursky, linux-kernel
On Wed, 2014-03-05 at 17:51 +0000, 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>
Acked-by: Davidlohr Bueso <davidlohr@hp.com>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] selftests: ipc: handle msgget failure return correctly
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
2014-03-05 18:58 ` Colin Ian King
1 sibling, 1 reply; 4+ messages in thread
From: Guillaume Morin @ 2014-03-05 18:50 UTC (permalink / raw)
To: Colin King; +Cc: Stanislav Kinsbursky, linux-kernel
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>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] selftests: ipc: handle msgget failure return correctly
2014-03-05 18:50 ` Guillaume Morin
@ 2014-03-05 18:58 ` Colin Ian King
0 siblings, 0 replies; 4+ messages in thread
From: Colin Ian King @ 2014-03-05 18:58 UTC (permalink / raw)
To: Stanislav Kinsbursky, linux-kernel
On 05/03/14 18:50, Guillaume Morin wrote:
> 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.
>
Yep, new patch been sent.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2014-03-05 18:58 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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
2014-03-05 18:58 ` Colin Ian King
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox