[virt-tools-list] [virt-viewer][PATCH 3/3] g_{message, warning}: Use printf style

Michal Privoznik mprivozn at redhat.com
Mon Feb 4 14:30:45 UTC 2013


The g_message() and g_warning functions expect printf style of
arguments. That is, whenever we want to print a string, it has
to be preceded with "%s" format.
---
 src/remote-viewer.c    | 2 +-
 src/virt-viewer-auth.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/remote-viewer.c b/src/remote-viewer.c
index a199310..fa17edd 100644
--- a/src/remote-viewer.c
+++ b/src/remote-viewer.c
@@ -637,7 +637,7 @@ remote_viewer_start(VirtViewerApp *app)
             g_free(path);
             if (error) {
                 virt_viewer_app_simple_message_dialog(app, _("Invalid file %s"), guri);
-                g_warning(error->message);
+                g_warning("%s", error->message);
                 g_clear_error(&error);
                 goto cleanup;
             }
diff --git a/src/virt-viewer-auth.c b/src/virt-viewer-auth.c
index 9751ac8..81f09bc 100644
--- a/src/virt-viewer-auth.c
+++ b/src/virt-viewer-auth.c
@@ -134,7 +134,7 @@ virt_viewer_auth_vnc_credentials(VirtViewerSession *session,
         }
         if (wantPassword && virt_viewer_file_is_set(file, "password")) {
             password = virt_viewer_file_get_password(file);
-            g_message (password);
+            g_message("%s", password);
             wantPassword = FALSE;
         }
     }
-- 
1.8.0.2




More information about the virt-tools-list mailing list