blob: cc738772833bc4174c5b75264ac46d203209bbee [file] [log] [blame] [edit]
diff -aruN a/CFXMLPreferencesDomain.c b/CFXMLPreferencesDomain.c
--- a/CFXMLPreferencesDomain.c 2009-02-19 08:32:54.000000000 -0800
+++ b/CFXMLPreferencesDomain.c 2012-04-25 10:35:53.000000000 -0700
@@ -239,9 +239,13 @@
#if DEPLOYMENT_TARGET_MACOSX || DEPLOYMENT_TARGET_LINUX
+#include <grp.h>
#include <stdio.h>
#include <sys/fcntl.h>
+#define __kCFAdminGroupName "admin"
+#define __kCFAdminFallbackGroupID 80
+
/* __CFWriteBytesToFileWithAtomicity is a "safe save" facility. Write the bytes using the specified mode on the file to the provided URL. If the atomic flag is true, try to do it in a fashion that will enable a safe save.
*/
static Boolean __CFWriteBytesToFileWithAtomicity(CFURLRef url, const void *bytes, int length, SInt32 mode, Boolean atomic) {
@@ -265,8 +270,10 @@
} else {
mode = 0664;
if (writingFileAsRoot && (0 == strncmp(cpath, "/Library/Preferences", 20))) {
+ const struct group *grent;
owner = geteuid();
- group = 80;
+ grent = getgrnam(__kCFAdminGroupName);
+ group = grent ? grent->gr_gid : __kCFAdminFallbackGroupID;
}
}
}