From: Avi Kivity <[EMAIL PROTECTED]> sdl.c and vnc.c are no longer compiled with the USE_KVM define, so the "QEMU/KVM" setting went away. Moving the name generation into vl.c fixes that.
Signed-off-by: Avi Kivity <[EMAIL PROTECTED]> diff --git a/qemu/console.h b/qemu/console.h index 1ac74fa..9782272 100644 --- a/qemu/console.h +++ b/qemu/console.h @@ -151,4 +151,6 @@ const char *readline_get_history(unsigned int index); void readline_start(const char *prompt, int is_password, ReadLineFunc *readline_func, void *opaque); +void decorate_application_name(char *name, int max_len); + #endif diff --git a/qemu/sdl.c b/qemu/sdl.c index 5b9a06b..dd9b8f7 100644 --- a/qemu/sdl.c +++ b/qemu/sdl.c @@ -232,11 +232,7 @@ static void sdl_update_caption(void) status = " - Press Ctrl-Alt-Shift to exit grab"; } -#if USE_KVM - if (kvm_allowed) { - strncat(appname, "/KVM", sizeof(appname)); - } -#endif + decorate_application_name(appname, sizeof appname); if (qemu_name) snprintf(buf, sizeof(buf), "%s (%s)%s", appname, qemu_name, status); diff --git a/qemu/vl.c b/qemu/vl.c index 28805a6..36a5928 100644 --- a/qemu/vl.c +++ b/qemu/vl.c @@ -254,6 +254,19 @@ static int event_pending = 1; #define TFR(expr) do { if ((expr) != -1) break; } while (errno == EINTR) +void decorate_application_name(char *appname, int max_len) +{ +#if USE_KVM + if (kvm_allowed) + { + int remain = max_len - strlen(appname) - 1; + + if (remain > 0) + strncat(appname, "/KVM", remain); + } +#endif +} + /***********************************************************/ /* x86 ISA bus support */ diff --git a/qemu/vnc.c b/qemu/vnc.c index f1eeedb..1a96857 100644 --- a/qemu/vnc.c +++ b/qemu/vnc.c @@ -1260,7 +1260,7 @@ static int protocol_client_init(VncState *vs, uint8_t *data, size_t len) char pad[3] = { 0, 0, 0 }; char buf[1024]; int size; - unsigned char *prog = "QEMU"; + char prog[30] = "QEMU"; vs->width = vs->ds->width; vs->height = vs->ds->height; @@ -1305,10 +1305,7 @@ static int protocol_client_init(VncState *vs, uint8_t *data, size_t len) vnc_write(vs, pad, 3); /* padding */ -#if USE_KVM - if (kvm_allowed) - prog = "QEMU/KVM"; -#endif + decorate_application_name((char *)prog, sizeof prog); if (qemu_name) size = snprintf(buf, sizeof(buf), "%s (%s)", prog, qemu_name); ------------------------------------------------------------------------- SF.Net email is sponsored by: Check out the new SourceForge.net Marketplace. It's the best place to buy or sell services for just about anything Open Source. http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace _______________________________________________ kvm-commits mailing list kvm-commits@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/kvm-commits