[Piglit] [PATCH] piglit: fix crashes when using original GLUT

Brian Paul brianp at vmware.com
Mon Oct 15 10:30:51 PDT 2012


The glutInit() function in the original GLUT expects argv[0] to be the
program name (as from main()), not a NULL pointer.  A strrchr() call
crashes on NULL.

For now, set argv[0]="piglit".  Previously, glutInit would get the
program path/name and it would appear in the window title.

This seems to be a regression since the waffle changes.
---
 .../piglit-framework-gl/piglit_glut_framework.c    |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/tests/util/piglit-framework-gl/piglit_glut_framework.c b/tests/util/piglit-framework-gl/piglit_glut_framework.c
index 29c75ec..885d7ef 100644
--- a/tests/util/piglit-framework-gl/piglit_glut_framework.c
+++ b/tests/util/piglit-framework-gl/piglit_glut_framework.c
@@ -96,8 +96,8 @@ static void
 init_glut(void)
 {
 	const struct piglit_gl_test_config *test_config = glut_fw.gl_fw.test_config;
-	char *argv[] = {0};
-	int argc = 0;
+	char *argv[] = {"piglit"};
+	int argc = 1;
 
 	glutInit(&argc, argv);
 	glutInitWindowPosition(0, 0);
-- 
1.7.3.4



More information about the Piglit mailing list