[gdm/gnome-2-30] Fix various compiler warnings



commit 1cd08c5212dc95a93a1705d68d9a26da56bdcbfa
Author: William Jon McCann <jmccann redhat com>
Date:   Thu Jun 17 14:26:32 2010 -0400

    Fix various compiler warnings

 daemon/gdm-session-worker.c                        |   23 ++++++++++++++-----
 daemon/gdm-welcome-session.c                       |   15 +++++++++---
 daemon/test-session.c                              |   19 +++++++++++++---
 gui/simple-greeter/gdm-user-chooser-dialog.c       |    9 -------
 .../libnotificationarea/na-tray-child.c            |    2 +-
 5 files changed, 44 insertions(+), 24 deletions(-)
---
diff --git a/daemon/gdm-session-worker.c b/daemon/gdm-session-worker.c
index 03a1d80..ea3662a 100644
--- a/daemon/gdm-session-worker.c
+++ b/daemon/gdm-session-worker.c
@@ -1003,7 +1003,7 @@ gdm_cache_copy_file (GdmSessionWorker *worker,
 {
         gboolean res;
 
-        g_debug ("Checking if %s should be copied to cache %s",
+        g_debug ("GdmSessionWorker: Checking if %s should be copied to cache %s",
                  userfilename, cachefilename);
 
         res = check_user_copy_file (userfilename,
@@ -1034,9 +1034,16 @@ gdm_cache_copy_file (GdmSessionWorker *worker,
                                    error->message);
                         g_error_free (error);
                  } else {
-                        chown (cachefilename,
-                               worker->priv->uid,
-                               worker->priv->gid);
+                         int res;
+
+                         res = chown (cachefilename,
+                                      worker->priv->uid,
+                                      worker->priv->gid);
+                         if (res == -1) {
+                                 g_warning ("GdmSessionWorker: Error setting owner of cache file: %s",
+                                            g_strerror (errno));
+                         }
+
                         g_chmod (cachefilename, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH);
                         g_debug ("Copy successful");
                 }
@@ -1070,7 +1077,11 @@ gdm_session_worker_create_cachedir (GdmSessionWorker *worker)
                 g_chmod (cachedir,
                          S_IRWXU | S_IXGRP | S_IRGRP | S_IXOTH | S_IROTH);
         }
-        chown (cachedir, worker->priv->uid, worker->priv->gid);
+        r = chown (cachedir, worker->priv->uid, worker->priv->gid);
+        if (r == -1) {
+                g_warning ("GdmSessionWorker: Error setting owner of cache directory: %s",
+                           g_strerror (errno));
+        }
 
         return cachedir;
 }
@@ -1191,7 +1202,7 @@ gdm_session_worker_uninitialize_pam (GdmSessionWorker *worker,
 #endif  /* HAVE_LOGINDEVPERM */
 
         } else {
-                void *p;
+                const void *p;
 
                 if ((pam_get_item (worker->priv->pam_handle, PAM_USER, &p)) == PAM_SUCCESS) {
                         gdm_session_auditor_set_username (worker->priv->auditor, (const char *)p);
diff --git a/daemon/gdm-welcome-session.c b/daemon/gdm-welcome-session.c
index c0842ac..9fc6717 100644
--- a/daemon/gdm-welcome-session.c
+++ b/daemon/gdm-welcome-session.c
@@ -239,7 +239,8 @@ close_welcome_session (GdmWelcomeSession *welcome_session)
 }
 
 static void
-load_lang_config_file (const gchar *config_file, const gchar **str_array)
+load_lang_config_file (const char  *config_file,
+                       const char **str_array)
 {
         gchar         *contents = NULL;
         gchar         *p;
@@ -275,7 +276,7 @@ load_lang_config_file (const gchar *config_file, const gchar **str_array)
                 return;
         }
 
-        str_joinv = g_strjoinv ("|", str_array);
+        str_joinv = g_strjoinv ("|", (char **) str_array);
         if (str_joinv == NULL) {
                 g_warning ("Error in joined");
                 g_free (contents);
@@ -355,7 +356,8 @@ get_welcome_environment (GdmWelcomeSession *welcome_session)
         };
         int i;
 
-        load_lang_config_file (LANG_CONFIG_FILE, optional_environment);
+        load_lang_config_file (LANG_CONFIG_FILE,
+                               (const char **) optional_environment);
         env = g_ptr_array_new ();
 
         /* create a hash table of current environment, then update keys has necessary */
@@ -522,6 +524,7 @@ spawn_child_setup (SpawnChildData *data)
 {
         struct passwd *pwent;
         struct group  *grent;
+        int            res;
 
         if (data->user_name == NULL) {
                 return;
@@ -543,7 +546,11 @@ spawn_child_setup (SpawnChildData *data)
 
         g_debug ("GdmWelcomeSession: Setting up run time dir %s", data->runtime_dir);
         g_mkdir (data->runtime_dir, 0755);
-        chown (data->runtime_dir, pwent->pw_uid, pwent->pw_gid);
+        res = chown (data->runtime_dir, pwent->pw_uid, pwent->pw_gid);
+        if (res == -1) {
+                g_warning ("GdmWelcomeSession: Error setting owner of run time directory: %s",
+                           g_strerror (errno));
+        }
 
         g_debug ("GdmWelcomeSession: Changing (uid:gid) for child process to (%d:%d)",
                  pwent->pw_uid,
diff --git a/daemon/test-session.c b/daemon/test-session.c
index 9a4d7cf..8bed085 100644
--- a/daemon/test-session.c
+++ b/daemon/test-session.c
@@ -166,12 +166,18 @@ static void
 on_info_query (GdmSession *session,
                const char *query_text)
 {
-        char answer[1024];
+        char  answer[1024];
+        char *res;
 
         g_print ("%s ", query_text);
 
-        fgets (answer, sizeof (answer), stdin);
-        answer[strlen(answer) - 1] = '\0';
+        answer[0] = '\0';
+        res = fgets (answer, sizeof (answer), stdin);
+        if (res == NULL) {
+                g_warning ("Couldn't get an answer");
+        }
+
+        answer[strlen (answer) - 1] = '\0';
 
         if (answer[0] == '\0') {
                 gdm_session_close (session);
@@ -200,6 +206,7 @@ on_secret_info_query (GdmSession *session,
                       const char *query_text)
 {
         char           answer[1024];
+        char          *res;
         struct termios ts0;
         struct termios ts1;
 
@@ -214,8 +221,12 @@ on_secret_info_query (GdmSession *session,
                 exit (1);
         }
 
-        fgets (answer, sizeof (answer), stdin);
+        answer[0] = '\0';
+        res = fgets (answer, sizeof (answer), stdin);
         answer[strlen (answer) - 1] = '\0';
+        if (res == NULL) {
+                g_warning ("Couldn't get an answer");
+        }
 
         tcsetattr (fileno (stdin), TCSANOW, &ts0);
 
diff --git a/gui/simple-greeter/gdm-user-chooser-dialog.c b/gui/simple-greeter/gdm-user-chooser-dialog.c
index 4667a68..eeb25fc 100644
--- a/gui/simple-greeter/gdm-user-chooser-dialog.c
+++ b/gui/simple-greeter/gdm-user-chooser-dialog.c
@@ -63,15 +63,6 @@ gdm_user_chooser_dialog_get_chosen_user_name (GdmUserChooserDialog *dialog)
 }
 
 void
-gdm_user_chooser_dialog_set_show_user_other (GdmUserChooserDialog *dialog,
-                                             gboolean              show_user)
-{
-        g_return_if_fail (GDM_IS_USER_CHOOSER_DIALOG (dialog));
-
-        gdm_user_chooser_widget_set_show_user_other (GDM_USER_CHOOSER_WIDGET (dialog->priv->chooser_widget), show_user);
-}
-
-void
 gdm_user_chooser_dialog_set_show_user_guest (GdmUserChooserDialog *dialog,
                                              gboolean              show_user)
 {
diff --git a/gui/simple-greeter/libnotificationarea/na-tray-child.c b/gui/simple-greeter/libnotificationarea/na-tray-child.c
index 98769bd..6355791 100644
--- a/gui/simple-greeter/libnotificationarea/na-tray-child.c
+++ b/gui/simple-greeter/libnotificationarea/na-tray-child.c
@@ -391,7 +391,7 @@ na_tray_child_force_redraw (NaTrayChild *child)
 {
   GtkWidget *widget = GTK_WIDGET (child);
 
-  if (GTK_WIDGET_MAPPED (child) && child->parent_relative_bg)
+  if (GTK_WIDGET_MAPPED (widget) && child->parent_relative_bg)
     {
 #if 1
       /* Sending an ExposeEvent might cause redraw problems if the



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