lkml.org 
[lkml]   [2014]   [Mar]   [5]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH][v2] selftests: ipc: handle msgget failure return correctly
Date
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..aa290c0 100644
--- a/tools/testing/selftests/ipc/msgque.c
+++ b/tools/testing/selftests/ipc/msgque.c
@@ -201,6 +201,7 @@ int main(int argc, char **argv)

msgque.msq_id = msgget(msgque.key, IPC_CREAT | IPC_EXCL | 0666);
if (msgque.msq_id == -1) {
+ err = -errno;
printf("Can't create queue\n");
goto err_out;
}
--
1.9.0


\
 
 \ /
  Last update: 2014-03-05 20:41    [W:0.045 / U:0.236 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site