Index: gnome-about-me.c
===================================================================
--- gnome-about-me.c	(revision 7517)
+++ gnome-about-me.c	(working copy)
@@ -23,6 +23,7 @@
 #  include <config.h>
 #endif
 
+#include <glib/gstdio.h>
 #include <gnome.h>
 #include <pwd.h>
 #include <libgnomevfs/gnome-vfs.h>
@@ -452,7 +453,6 @@
 	GladeXML      *dialog;	
 	EContactPhoto *photo;
 	gchar         *file;
-	FILE	      *fp;
 
 	guchar 	      *data;
 	gsize 	       length;
@@ -515,12 +515,21 @@
 
 		/* Save the image for GDM */
 		/* FIXME: I would have to read the default used by the gdmgreeter program */
-		file = g_strdup_printf ("%s/.face", g_get_home_dir ());
-		fp = fopen (file, "wb");
-		fwrite (photo->data.inlined.data, 1, photo->data.inlined.length, fp);
-		fclose (fp);
+		file = g_build_filename (g_get_home_dir (), ".face", NULL);
+		if (g_unlink (file) == 0 || errno == ENOENT) {
+			if (g_file_set_contents (file,
+						 photo->data.inlined.data,
+						 photo->data.inlined.length,
+						 NULL) != FALSE) {
+				g_chmod (file, 0755);
+			} else {
+				g_warning ("Could not create %s", file);
+			}
+		} else {
+			g_warning ("Could not delete %s", file);
+		}
 
-		g_free (file);	
+		g_free (file);
 
 		e_contact_photo_free (photo);
 
