public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [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

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