Blob Blame History Raw
From 726343c9b597256c523c920b39a83b66f5b5f86a Mon Sep 17 00:00:00 2001
From: Matthias Clasen <mclasen@redhat.com>
Date: Tue, 29 Nov 2011 23:07:38 -0500
Subject: [PATCH] Be more careful when resetting the users icons

When the current icon is in /usr/share, and we reset the
icon, we try to delete a nonexisting icon file in
/var/lib/AccountsService/icons. Deal with this eventuality.
---
 src/user.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/src/user.c b/src/user.c
index e0e9445..fbc91be 100644
--- a/src/user.c
+++ b/src/user.c
@@ -1397,7 +1397,8 @@ user_change_icon_file_authorized_cb (Daemon                *daemon,
                 g_free (dest_path);
 
                 error = NULL;
-                if (!g_file_delete (dest, NULL, &error)) {
+                if (!g_file_delete (dest, NULL, &error) &&
+                    !g_error_matches (error, G_IO_ERROR, G_IO_ERROR_NOT_FOUND)) {
                         g_object_unref (dest);
                         throw_error (context, ERROR_FAILED, "failed to remove user icon, %s", error->message);
                         g_error_free (error);
-- 
1.7.7.3