[gtk-vnc] Fix compile warnings



commit 6057789bfaef2116e7ded32836db248ab9bfcb88
Author: Daniel P. Berrange <berrange redhat com>
Date:   Sat Mar 20 19:01:50 2010 +0000

    Fix compile warnings
    
    Fix the compile warnings / initialization order bug from
    
      commit 0a6bae9c19e9f86dda5433d8260d5f29e7ef4ed1
    
    * src/vncdisplay.c: Fix variable init order & mark function static

 src/vncdisplay.c |   24 ++++++++++--------------
 1 files changed, 10 insertions(+), 14 deletions(-)
---
diff --git a/src/vncdisplay.c b/src/vncdisplay.c
index 38a19fe..d6464f7 100644
--- a/src/vncdisplay.c
+++ b/src/vncdisplay.c
@@ -2018,10 +2018,11 @@ static void vnc_display_init(VncDisplay *display)
 	priv->gvnc = gvnc_new(&vnc_display_ops, obj);
 }
 
-char* vnc_display_best_path(const char *basedir,
-			    const char *basefile,
-			    char **dirs,
-			    unsigned int ndirs)
+static char *
+vnc_display_best_path(const char *basedir,
+		      const char *basefile,
+		      char **dirs,
+		      unsigned int ndirs)
 {
 	unsigned int i;
 	char *path;
@@ -2039,24 +2040,19 @@ static int vnc_display_set_x509_credential(VncDisplay *obj, const char *name)
 {
 	gboolean ret = FALSE;
 	char *file;
-	char *sysdir;
+	char *sysdir = g_strdup_printf("%s/pki", SYSCONFDIR);
 #ifndef WIN32
-	char *userdir;
 	struct passwd *pw;
-	char *dirs[] = { sysdir, userdir };
-#else
-	char *dirs[] = { sysdir };
-#endif
 
-#ifndef WIN32
 	if (!(pw = getpwuid(getuid())))
 		return TRUE;
 
-	userdir = g_strdup_printf("%s/.pki", pw->pw_dir);
+	char *userdir = g_strdup_printf("%s/.pki", pw->pw_dir);
+	char *dirs[] = { sysdir, userdir };
+#else
+	char *dirs[] = { sysdir };
 #endif
 
-	sysdir = g_strdup_printf("%s/pki", SYSCONFDIR);
-
 	if ((file = vnc_display_best_path("CA", "cacert.pem", dirs,
 				  sizeof(dirs)/sizeof(dirs[0]))) == NULL) {
 		ret = TRUE;



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]