glMainLoop() crashes

I am working on OpenGL on Linux with ATI Xpert 2000 and ATI 9550. I have downloaded Mesa-6.2.1. I am running a simple sample as follow:

#include <stdio.h>
#include <math.h>
#include <strings.h>
#include <unistd.h>

#include <GL/gl.h>
#include <GL/glu.h>
#include <GL/glut.h>

// Called to draw scene
void RenderScene(void)
{
// Clear the buffer
glClear(GL_COLOR_BUFFER_BIT);

glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);

glBegin(GL_POLYGON);
    glVertex2f(0.4, 0.4);
glVertex2f(0.4, 0.9);
glVertex2f(0.9, 0.9);
    glVertex2f(0.9, 0.4);
glEnd();

// execute drawing commands
glFlush();

}

void SetupRC(void)
{
glClearColor(1, 0, 0, 0);
}

// Map the above rectangle coords to window system by glViewport
// and glOrtho
void ChangeSize(GLint w, GLint h)
{
glOrtho(0, 1, 0, 1, 0, 1);
}

int main(int argc, char argv[])
{
glutInitDisplayMode(GLUT_SINGLE);
/
A single-buffered window means that all drawing commands
are performed on the window displayed. A double-buffered
window means that the drawing commands are actually executed
to create a scence offscreen and then quilckly swapped into
view on the window.
*/

// create a window
glutInitWindowSize(800, 600);
glutInitWindowPosition(2, 20);
glutCreateWindow("GLRect");

// initialize OpenGL states before rendering
SetupRC();

glutReshapeFunc(ChangeSize);

printf("finish Reshape
");

// Diaplay or refresh window
glutDisplayFunc(RenderScene);

printf("finish RenderScene
");

// Processing all OS specific messages, keystrokes and so on.
glutMainLoop();

printf("finish Mainloop
");
exit (0);
}

I can build it, but crashes on glutMainLoop() when I run it. If I change glPolygonMode(GL_FRONT_AND_BACK, GL_FILL) to glPolygonMode(GL_FRONT_AND_BACK, GL_LINE), It is OK.

Can anybody know the reason? Thanks a lot.

Kevin

You need to call:

glutInit(&argc, argv);

before you call glutInitDisplayMode();