blob: db1f9ce734a9ae0d593c6d5d6584219e32e06253 [file] [log] [blame]
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
@@ -238,9 +238,10 @@
}
-#if DEPLOYMENT_TARGET_MACOSX
+#if DEPLOYMENT_TARGET_MACOSX || DEPLOYMENT_TARGET_LINUX
+#include <stdio.h>
#include <sys/fcntl.h>
/* __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) {
@@ -264,6 +269,6 @@
if (atomic) {
CFURLRef dir = CFURLCreateCopyDeletingLastPathComponent(kCFAllocatorSystemDefault, url);
- CFURLRef tempFile = CFURLCreateCopyAppendingPathComponent(kCFAllocatorSystemDefault, dir, CFSTR("cf#XXXXX"), false);
+ CFURLRef tempFile = CFURLCreateCopyAppendingPathComponent(kCFAllocatorSystemDefault, dir, CFSTR("cf#XXXXXX"), false);
CFRelease(dir);
if (!CFURLGetFileSystemRepresentation(tempFile, true, (uint8_t *)auxPath, CFMaxPathSize)) {
CFRelease(tempFile);
@@ -339,12 +346,12 @@
CFRelease(binStream);
if (data) {
SInt32 mode;
-#if DEPLOYMENT_TARGET_MACOSX
+#if DEPLOYMENT_TARGET_MACOSX || DEPLOYMENT_TARGET_LINUX
mode = isWorldReadable ? S_IRUSR|S_IWUSR|S_IRGRP|S_IROTH : S_IRUSR|S_IWUSR;
#else
mode = 0666;
#endif
-#if DEPLOYMENT_TARGET_MACOSX
+#if DEPLOYMENT_TARGET_MACOSX || DEPLOYMENT_TARGET_LINUX
{ // Try quick atomic way first, then fallback to slower ways and error cases
CFStringRef scheme = CFURLCopyScheme(url);
if (!scheme) {