summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWilliam Jon McCann <jmccann@redhat.com>2008-07-30 20:19:39 +0000
committerWilliam Jon McCann <mccann@src.gnome.org>2008-07-30 20:19:39 +0000
commit3d0975ff2308766d809db5ac788cbc212be53edb (patch)
tree22b6c28765dc277d63f695e5a7694388325e825a
parentcf7921f8f59a8dcc087ab9749225cac912ed0b17 (diff)
downloadgdm-3d0975ff2308766d809db5ac788cbc212be53edb.tar.gz
Remove the X authorizations directory when we're done with it.
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. svn path=/trunk/; revision=6337
-rw-r--r--ChangeLog6
-rw-r--r--daemon/gdm-display-access-file.c30
2 files changed, 31 insertions, 5 deletions
diff --git a/ChangeLog b/ChangeLog
index e5b70f69..5d5d1a9d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+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.
+
2008-07-28 William Jon McCann <jmccann@redhat.com>
* daemon/gdm-display-access-file.c (create_temp_dir),
diff --git a/daemon/gdm-display-access-file.c b/daemon/gdm-display-access-file.c
index b2777427..0d800b09 100644
--- a/daemon/gdm-display-access-file.c
+++ b/daemon/gdm-display-access-file.c
@@ -626,17 +626,37 @@ gdm_display_access_file_remove_display (GdmDisplayAccessFile *file,
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;
}