[virt-tools-list] [virt-viewer] Append \n to message in virt_viewer_app_trace

Christophe Fergeau cfergeau at redhat.com
Wed Sep 12 14:05:09 UTC 2012


Callers manually add a trailing \n when they call virt_viewer_app_trace,
but it's sometimes forgotten, leading to rhbz#822794. This commit
removes the \n from all callers (it was missing in a few of them)
and adds it in virt_viewer_app_trace.
---
 src/virt-viewer-app.c | 17 +++++++++--------
 src/virt-viewer.c     |  8 ++++----
 2 files changed, 13 insertions(+), 12 deletions(-)

diff --git a/src/virt-viewer-app.c b/src/virt-viewer-app.c
index def52c5..a95687a 100644
--- a/src/virt-viewer-app.c
+++ b/src/virt-viewer-app.c
@@ -431,6 +431,7 @@ virt_viewer_app_trace(VirtViewerApp *self,
         va_start(ap, fmt);
         g_vprintf(fmt, ap);
         va_end(ap);
+        g_print("\n");
     }
 }
 
@@ -703,7 +704,7 @@ virt_viewer_app_create_session(VirtViewerApp *self, const gchar *type)
 #ifdef HAVE_GTK_VNC
     if (g_ascii_strcasecmp(type, "vnc") == 0) {
         GtkWindow *window = virt_viewer_window_get_window(priv->main_window);
-        virt_viewer_app_trace(self, "Guest %s has a %s display\n",
+        virt_viewer_app_trace(self, "Guest %s has a %s display",
                               priv->guest_name, type);
         priv->session = virt_viewer_session_vnc_new(window);
     } else
@@ -711,13 +712,13 @@ virt_viewer_app_create_session(VirtViewerApp *self, const gchar *type)
 #ifdef HAVE_SPICE_GTK
     if (g_ascii_strcasecmp(type, "spice") == 0) {
         GtkWindow *window = virt_viewer_window_get_window(priv->main_window);
-        virt_viewer_app_trace(self, "Guest %s has a %s display\n",
+        virt_viewer_app_trace(self, "Guest %s has a %s display",
                               priv->guest_name, type);
         priv->session = virt_viewer_session_spice_new(self, window);
     } else
 #endif
     {
-        virt_viewer_app_trace(self, "Guest %s has unsupported %s display type\n",
+        virt_viewer_app_trace(self, "Guest %s has unsupported %s display type",
                               priv->guest_name, type);
         virt_viewer_app_simple_message_dialog(self, _("Unknown graphic type for the guest %s"),
                                               priv->guest_name);
@@ -833,16 +834,16 @@ virt_viewer_app_default_activate(VirtViewerApp *self)
         gchar *p = NULL;
 
         if (priv->gport) {
-            virt_viewer_app_trace(self, "Opening indirect TCP connection to display at %s:%s\n",
+            virt_viewer_app_trace(self, "Opening indirect TCP connection to display at %s:%s",
                                   priv->ghost, priv->gport);
         } else {
-            virt_viewer_app_trace(self, "Opening indirect UNIX connection to display at %s\n",
+            virt_viewer_app_trace(self, "Opening indirect UNIX connection to display at %s",
                                   priv->unixsock);
         }
         if (priv->port)
             p = g_strdup_printf(":%d", priv->port);
 
-        virt_viewer_app_trace(self, "Setting up SSH tunnel via %s%s%s%s\n",
+        virt_viewer_app_trace(self, "Setting up SSH tunnel via %s%s%s%s",
                               priv->user ? priv->user : "",
                               priv->user ? "@" : "",
                               priv->host, p ? p : "");
@@ -863,10 +864,10 @@ virt_viewer_app_default_activate(VirtViewerApp *self)
     if (fd >= 0) {
         return virt_viewer_session_open_fd(VIRT_VIEWER_SESSION(priv->session), fd);
     } else if (priv->guri) {
-        virt_viewer_app_trace(self, "Opening connection to display at %s\n", priv->guri);
+        virt_viewer_app_trace(self, "Opening connection to display at %s", priv->guri);
         return virt_viewer_session_open_uri(VIRT_VIEWER_SESSION(priv->session), priv->guri);
     } else {
-        virt_viewer_app_trace(self, "Opening direct TCP connection to display at %s:%s:%s\n",
+        virt_viewer_app_trace(self, "Opening direct TCP connection to display at %s:%s:%s",
                               priv->ghost, priv->gport, priv->gtlsport ? priv->gtlsport : "-1");
         return virt_viewer_session_open_host(VIRT_VIEWER_SESSION(priv->session),
                                              priv->ghost, priv->gport, priv->gtlsport);
diff --git a/src/virt-viewer.c b/src/virt-viewer.c
index 3143104..0a4cea7 100644
--- a/src/virt-viewer.c
+++ b/src/virt-viewer.c
@@ -390,7 +390,7 @@ virt_viewer_update_display(VirtViewer *self, virDomainPtr dom)
     priv->dom = dom;
     virDomainRef(priv->dom);
 
-    virt_viewer_app_trace(app, "Guest %s is running, determining display\n",
+    virt_viewer_app_trace(app, "Guest %s is running, determining display",
                           priv->domkey);
 
     g_object_set(app, "title", virDomainGetName(dom), NULL);
@@ -476,7 +476,7 @@ virt_viewer_initial_connect(VirtViewerApp *app)
     if (!dom) {
         if (priv->waitvm) {
             virt_viewer_app_show_status(app, _("Waiting for guest domain to be created"));
-            virt_viewer_app_trace(app, "Guest %s does not yet exist, waiting for it to be created\n",
+            virt_viewer_app_trace(app, "Guest %s does not yet exist, waiting for it to be created",
                                   priv->domkey);
             goto done;
         } else {
@@ -502,7 +502,7 @@ virt_viewer_initial_connect(VirtViewerApp *app)
         if (ret < 0) {
             if (priv->waitvm) {
                 virt_viewer_app_show_status(app, _("Waiting for guest domain to start server"));
-                virt_viewer_app_trace(app, "Guest %s has not activated its display yet, waiting for it to start\n",
+                virt_viewer_app_trace(app, "Guest %s has not activated its display yet, waiting for it to start",
                                       priv->domkey);
             } else {
                 DEBUG_LOG("Failed to activate viewer");
@@ -614,7 +614,7 @@ virt_viewer_start(VirtViewerApp *app)
 
     virSetErrorFunc(NULL, virt_viewer_error_func);
 
-    virt_viewer_app_trace(app, "Opening connection to libvirt with URI %s\n",
+    virt_viewer_app_trace(app, "Opening connection to libvirt with URI %s",
                           priv->uri ? priv->uri : "<null>");
     priv->conn = virConnectOpenAuth(priv->uri,
                                     //virConnectAuthPtrDefault,
-- 
1.7.11.4




More information about the virt-tools-list mailing list