Revision 5b08fc10

b/curses.c
350 350
    atexit(curses_atexit);
351 351

  
352 352
#ifndef _WIN32
353
    signal(SIGINT, SIG_DFL);
354
    signal(SIGQUIT, SIG_DFL);
355 353
#if defined(SIGWINCH) && defined(KEY_RESIZE)
356 354
    /* some curses implementations provide a handler, but we
357 355
     * want to be sure this is handled regardless of the library */
b/sdl.c
476 476
                sdl_process_key(&ev->key);
477 477
            break;
478 478
        case SDL_QUIT:
479
            if (!no_quit) {
479
            if (!no_quit)
480 480
                qemu_system_shutdown_request();
481
                vm_start();	/* In case we're paused */
482
            }
483 481
            break;
484 482
        case SDL_MOUSEMOTION:
485 483
            if (gui_grab || kbd_mouse_is_absolute() ||
......
636 634
        fprintf(stderr, "Could not initialize SDL - exiting\n");
637 635
        exit(1);
638 636
    }
639
#ifndef _WIN32
640
    /* NOTE: we still want Ctrl-C to work, so we undo the SDL redirections */
641
    signal(SIGINT, SIG_DFL);
642
    signal(SIGQUIT, SIG_DFL);
643
#endif
644 637

  
645 638
    ds->dpy_update = sdl_update;
646 639
    ds->dpy_resize = sdl_resize;
b/vl.c
7621 7621
                timeout = 0;
7622 7622
            }
7623 7623
        } else {
7624
            if (shutdown_requested)
7625
                break;
7624 7626
            timeout = 10;
7625 7627
        }
7626 7628
#ifdef CONFIG_PROFILER
......
8185 8187

  
8186 8188
#define MAX_NET_CLIENTS 32
8187 8189

  
8190
#ifndef _WIN32
8191

  
8192
static void termsig_handler(int signal)
8193
{
8194
    qemu_system_shutdown_request();
8195
}
8196

  
8197
void termsig_setup(void)
8198
{
8199
    struct sigaction act;
8200

  
8201
    memset(&act, 0, sizeof(act));
8202
    act.sa_handler = termsig_handler;
8203
    sigaction(SIGINT,  &act, NULL);
8204
    sigaction(SIGHUP,  &act, NULL);
8205
    sigaction(SIGTERM, &act, NULL);
8206
}
8207

  
8208
#endif
8209

  
8188 8210
int main(int argc, char **argv)
8189 8211
{
8190 8212
#ifdef CONFIG_GDBSTUB
......
9073 9095
#endif
9074 9096
    }
9075 9097

  
9098
#ifndef _WIN32
9099
    /* must be after terminal init, SDL library changes signal handlers */
9100
    termsig_setup();
9101
#endif
9102

  
9076 9103
    /* Maintain compatibility with multiple stdio monitors */
9077 9104
    if (!strcmp(monitor_device,"stdio")) {
9078 9105
        for (i = 0; i < MAX_SERIAL_PORTS; i++) {

Also available in: Unified diff