NetworkManager r3590 - trunk/system-settings/plugins/keyfile



Author: dcbw
Date: Wed Apr 23 03:00:37 2008
New Revision: 3590
URL: http://svn.gnome.org/viewvc/NetworkManager?rev=3590&view=rev

Log:
Don't ingore return value of chown

Modified:
   trunk/system-settings/plugins/keyfile/writer.c

Modified: trunk/system-settings/plugins/keyfile/writer.c
==============================================================================
--- trunk/system-settings/plugins/keyfile/writer.c	(original)
+++ trunk/system-settings/plugins/keyfile/writer.c	Wed Apr 23 03:00:37 2008
@@ -2,6 +2,7 @@
 
 #include <sys/stat.h>
 #include <unistd.h>
+#include <errno.h>
 #include <dbus/dbus-glib.h>
 #include <nm-setting.h>
 #include <nm-setting-connection.h>
@@ -142,10 +143,13 @@
 		filename = g_build_filename (KEYFILE_DIR, s_con->id, NULL);
 		g_file_set_contents (filename, data, len, &err);
 		chmod (filename, S_IRUSR | S_IWUSR);
-		chown (filename, 0, 0);
+		if (chown (filename, 0, 0) < 0) {
+			g_warning ("Error chowning '%s': %d", filename, errno);
+			unlink (filename);
+		} else
+			success = TRUE;
 
 		g_free (filename);
-		success = TRUE;
 	}
 
 	if (err) {



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