gdm r6337 - in trunk: . daemon



Author: mccann
Date: Wed Jul 30 20:19:39 2008
New Revision: 6337
URL: http://svn.gnome.org/viewvc/gdm?rev=6337&view=rev

Log:
2008-07-30  William Jon McCann  <jmccann redhat com>

	* daemon/gdm-display-access-file.c (gdm_display_access_file_close):
	Remove the X authorizations directory when we're done
	with it.



Modified:
   trunk/ChangeLog
   trunk/daemon/gdm-display-access-file.c

Modified: trunk/daemon/gdm-display-access-file.c
==============================================================================
--- trunk/daemon/gdm-display-access-file.c	(original)
+++ trunk/daemon/gdm-display-access-file.c	Wed Jul 30 20:19:39 2008
@@ -626,17 +626,37 @@
 void
 gdm_display_access_file_close (GdmDisplayAccessFile  *file)
 {
+        char *auth_dir;
+
         g_return_if_fail (file != NULL);
         g_return_if_fail (file->priv->fp != NULL);
         g_return_if_fail (file->priv->path != NULL);
 
-        g_unlink (file->priv->path);
-        if (file->priv->path != NULL) {
-                g_free (file->priv->path);
-                file->priv->path = NULL;
-                g_object_notify (G_OBJECT (file), "path");
+        errno = 0;
+        if (g_unlink (file->priv->path) != 0) {
+                g_warning ("GdmDisplayAccessFile: Unable to remove X11 authority database '%s': %s",
+                           file->priv->path,
+                           g_file_error_from_errno (errno));
+        }
+
+        /* still try to remove dir even if file remove failed,
+           may have already been removed by someone else */
+        /* we own the parent directory too */
+        auth_dir = g_path_get_dirname (file->priv->path);
+        if (auth_dir != NULL) {
+                errno = 0;
+                if (g_rmdir (auth_dir) != 0) {
+                        g_warning ("GdmDisplayAccessFile: Unable to remove X11 authority directory '%s': %s",
+                                   auth_dir,
+                                   g_file_error_from_errno (errno));
+                }
+                g_free (auth_dir);
         }
 
+        g_free (file->priv->path);
+        file->priv->path = NULL;
+        g_object_notify (G_OBJECT (file), "path");
+
         fclose (file->priv->fp);
         file->priv->fp = NULL;
 }



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