@@ -46,7 +46,7 @@ ConsoleGLState *console_gl_init_context(void)
gls->texture_blit_prog = qemu_gl_create_compile_link_program
(texture_blit_vert_src, texture_blit_frag_src);
if (!gls->texture_blit_prog) {
- exit(1);
+ exit(EXIT_FAILURE);
}
gls->texture_blit_vao =
@@ -1389,7 +1389,7 @@ void register_displaychangelistener(DisplayChangeListener *dcl)
if (dcl->con->gl) {
fprintf(stderr, "can't register two opengl displays (%s, %s)\n",
dcl->ops->dpy_name, dcl->con->gl->ops->dpy_name);
- exit(1);
+ exit(EXIT_FAILURE);
}
dcl->con->gl = dcl;
}
@@ -408,7 +408,7 @@ static void curses_keyboard_setup(void)
if(keyboard_layout) {
kbd_layout = init_keyboard_layout(name2keysym, keyboard_layout);
if (!kbd_layout)
- exit(1);
+ exit(EXIT_FAILURE);
}
}
@@ -425,7 +425,7 @@ void curses_display_init(DisplayState *ds, int full_screen)
#ifndef _WIN32
if (!isatty(1)) {
fprintf(stderr, "We need a terminal output\n");
- exit(1);
+ exit(EXIT_FAILURE);
}
#endif
@@ -2158,7 +2158,7 @@ void gtk_display_init(DisplayState *ds, bool full_screen, bool grab_on_hover)
if (!gtkinit) {
fprintf(stderr, "gtk initialization failed\n");
- exit(1);
+ exit(EXIT_FAILURE);
}
s->window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
@@ -92,7 +92,7 @@ static void sdl_update(DisplayChangeListener *dcl,
} else {
if (sdl_zoom_blit(guest_screen, real_screen, SMOOTHING_ON, &rec) < 0) {
fprintf(stderr, "Zoom blit failed\n");
- exit(1);
+ exit(EXIT_FAILURE);
}
}
}
@@ -122,7 +122,7 @@ static void do_sdl_resize(int width, int height, int bpp)
if (!tmp_screen) {
fprintf(stderr, "Could not open SDL display (%dx%dx%d): %s\n",
width, height, bpp, SDL_GetError());
- exit(1);
+ exit(EXIT_FAILURE);
}
} else {
/*
@@ -957,7 +957,7 @@ void sdl_display_init(DisplayState *ds, int full_screen, int no_frame)
if(keyboard_layout) {
kbd_layout = init_keyboard_layout(name2keysym, keyboard_layout);
if (!kbd_layout)
- exit(1);
+ exit(EXIT_FAILURE);
}
if (no_frame)
@@ -987,7 +987,7 @@ void sdl_display_init(DisplayState *ds, int full_screen, int no_frame)
if (SDL_Init (flags)) {
fprintf(stderr, "Could not initialize SDL(%s) - exiting\n",
SDL_GetError());
- exit(1);
+ exit(EXIT_FAILURE);
}
vi = SDL_GetVideoInfo();
host_format = *(vi->vfmt);
@@ -783,7 +783,7 @@ void sdl_display_init(DisplayState *ds, int full_screen, int no_frame)
if (SDL_Init(flags)) {
fprintf(stderr, "Could not initialize SDL(%s) - exiting\n",
SDL_GetError());
- exit(1);
+ exit(EXIT_FAILURE);
}
SDL_SetHint(SDL_HINT_GRAB_KEYBOARD, "1");
@@ -333,7 +333,7 @@ static int parse_name(const char *string, const char *optname,
return value;
}
error_report("spice: invalid %s: %s", optname, string);
- exit(1);
+ exit(EXIT_FAILURE);
}
static const char *stream_video_names[] = {
@@ -605,7 +605,7 @@ static int add_channel(void *opaque, const char *name, const char *value,
if (!*tls_port) {
error_report("spice: tried to setup tls-channel"
" without specifying a TLS port");
- exit(1);
+ exit(EXIT_FAILURE);
}
security = SPICE_CHANNEL_SECURITY_SSL;
}
@@ -622,7 +622,7 @@ static int add_channel(void *opaque, const char *name, const char *value,
}
if (rc != 0) {
error_report("spice: failed to set channel security for %s", value);
- exit(1);
+ exit(EXIT_FAILURE);
}
return 0;
}
@@ -661,11 +661,11 @@ void qemu_spice_init(void)
tls_port = qemu_opt_get_number(opts, "tls-port", 0);
if (port < 0 || port > 65535) {
error_report("spice port is out of range");
- exit(1);
+ exit(EXIT_FAILURE);
}
if (tls_port < 0 || tls_port > 65535) {
error_report("spice tls-port is out of range");
- exit(1);
+ exit(EXIT_FAILURE);
}
password = qemu_opt_get(opts, "password");
@@ -736,7 +736,7 @@ void qemu_spice_init(void)
if (qemu_opt_get_bool(opts, "sasl", 0)) {
if (spice_server_set_sasl(spice_server, 1) == -1) {
error_report("spice: failed to enable sasl");
- exit(1);
+ exit(EXIT_FAILURE);
}
auth = "sasl";
}
@@ -755,7 +755,7 @@ void qemu_spice_init(void)
#else
error_report("this qemu build does not support the "
"\"disable-agent-file-xfer\" option");
- exit(1);
+ exit(EXIT_FAILURE);
#endif
}
@@ -803,7 +803,7 @@ void qemu_spice_init(void)
spice_server_set_sasl_appname(spice_server, "qemu");
if (spice_server_init(spice_server, &core_interface) != 0) {
error_report("failed to initialize spice server");
- exit(1);
+ exit(EXIT_FAILURE);
};
using_spice = 1;
@@ -831,11 +831,11 @@ void qemu_spice_init(void)
if ((port != 0) || (tls_port != 0)) {
error_report("SPICE GL support is local-only for now and "
"incompatible with -spice port/tls-port");
- exit(1);
+ exit(EXIT_FAILURE);
}
if (egl_rendernode_init() != 0) {
error_report("Failed to initialize EGL render node for SPICE GL");
- exit(1);
+ exit(EXIT_FAILURE);
}
display_opengl = 1;
}
@@ -847,7 +847,7 @@ int qemu_spice_add_interface(SpiceBaseInstance *sin)
if (!spice_server) {
if (QTAILQ_FIRST(&qemu_spice_opts.head) != NULL) {
error_report("Oops: spice configured but not active");
- exit(1);
+ exit(EXIT_FAILURE);
}
/*
* Create a spice server instance.
@@ -3154,7 +3154,7 @@ void vnc_display_init(const char *id)
}
if (!vs->kbd_layout)
- exit(1);
+ exit(EXIT_FAILURE);
vs->share_policy = VNC_SHARE_POLICY_ALLOW_EXCLUSIVE;
vs->connections_limit = 32;
@@ -3929,7 +3929,7 @@ int vnc_init_func(void *opaque, QemuOpts *opts, Error **errp)
vnc_display_open(id, &local_err);
if (local_err != NULL) {
error_reportf_err(local_err, "Failed to start VNC server: ");
- exit(1);
+ exit(EXIT_FAILURE);
}
return 0;
}
This patch is the result of coccinelle script scripts/coccinelle/exit.cocci Signed-off-by: Laurent Vivier <lvivier@redhat.com> CC: Gerd Hoffmann <kraxel@redhat.com> --- ui/console-gl.c | 2 +- ui/console.c | 2 +- ui/curses.c | 4 ++-- ui/gtk.c | 2 +- ui/sdl.c | 8 ++++---- ui/sdl2.c | 2 +- ui/spice-core.c | 22 +++++++++++----------- ui/vnc.c | 4 ++-- 8 files changed, 23 insertions(+), 23 deletions(-)