浏览代码

tools/testing/selftests/ipc/msgque.c: handle msgget failure return correctly

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>
Cc: Stanislav Kinsbursky <skinsbursky@parallels.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Colin Ian King 11 年之前
父节点
当前提交
5394223236
共有 1 个文件被更改,包括 1 次插入0 次删除
  1. 1 0
      tools/testing/selftests/ipc/msgque.c

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