diff options
author | William Jon McCann <jmccann@redhat.com> | 2008-07-30 20:19:39 +0000 |
---|---|---|
committer | William Jon McCann <mccann@src.gnome.org> | 2008-07-30 20:19:39 +0000 |
commit | 3d0975ff2308766d809db5ac788cbc212be53edb (patch) | |
tree | 22b6c28765dc277d63f695e5a7694388325e825a /daemon | |
parent | cf7921f8f59a8dcc087ab9749225cac912ed0b17 (diff) | |
download | gdm-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
Diffstat (limited to 'daemon')
-rw-r--r-- | daemon/gdm-display-access-file.c | 30 |
1 files changed, 25 insertions, 5 deletions
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; } |