I don't understand why this code is failing. It doesn't display the menu, but the cursor changes as if it was there. Then it crashes and prints out that it encountered a segmentation fault and did a core dump.

Code:
static unsigned short daynight = 0;

void DayorNight(int choice){
    daynight = (choice - 1) * 50;  //either 0 or 50
}

int main (int argc, char** argv){
    glutInit (&argc, argv);
    glutInitDisplayMode (GLUT_DOUBLE|GLUT_RGB);
    glutInitWindowSize (800, 600);
    glutInitWindowPosition (0, 0);
    glutCreateWindow (argv[0]);
    init ();
    glutReshapeFunc (reshape);
    glutDisplayFunc (display);
    glutIdleFunc(animate);
    glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
    glutMouseFunc(checkmouse);
    InitializeCars();

//problematic code?

    glutCreateMenu(DayorNight);
    glutAddMenuEntry("Night", 1);
    glutAddMenuEntry("Day", 2);
    glutAttachMenu(GLUT_RIGHT_BUTTON);
    
//

    //set up the timers
    seekchange = clock() + 150000;
    ResetTime = clock() + 33;  //should be 30FPS
    glutMainLoop ();
    return 0;
}
It's C if that's not obvious and everything else works until I right click on the screen.