diff options
author | mark@chromium.org <mark@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-06-14 22:12:46 +0000 |
---|---|---|
committer | mark@chromium.org <mark@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-06-14 22:12:46 +0000 |
commit | a8acdc80f627ea5cc7f9a5d4b47f5dfc4e029d52 (patch) | |
tree | b3f3f1a95f56163d79bcabf786eed706bb4049c2 /base/mac | |
parent | 6be09e62da1d4efc9baf2f7636b57281decee1bd (diff) | |
download | chromium_src-a8acdc80f627ea5cc7f9a5d4b47f5dfc4e029d52.zip chromium_src-a8acdc80f627ea5cc7f9a5d4b47f5dfc4e029d52.tar.gz chromium_src-a8acdc80f627ea5cc7f9a5d4b47f5dfc4e029d52.tar.bz2 |
Don't do the pre-emptive unexclude by-path on Lion. It's available to root
only so it never works for us and spews log messages:
"This process is attempting to exclude an item from Time Machine by path
without administrator privileges. This is not supported."
BUG=74053
TEST=No more console spew for this issue on Lion
Review URL: http://codereview.chromium.org/7166006
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@89081 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base/mac')
-rw-r--r-- | base/mac/mac_util.mm | 22 |
1 files changed, 16 insertions, 6 deletions
diff --git a/base/mac/mac_util.mm b/base/mac/mac_util.mm index 5a8cb4e..eebf133 100644 --- a/base/mac/mac_util.mm +++ b/base/mac/mac_util.mm @@ -243,12 +243,22 @@ void ActivateProcess(pid_t pid) { } bool SetFileBackupExclusion(const FilePath& file_path) { - NSString* filePath = + NSString* file_path_ns = [NSString stringWithUTF8String:file_path.value().c_str()]; - NSURL* url = [NSURL fileURLWithPath:filePath]; - // Do a pre-emptive unexclude by-path since by-path exclusions may have been - // performed on this file in the past. - CSBackupSetItemExcluded(base::mac::NSToCFCast(url), FALSE, TRUE); + NSURL* file_url = [NSURL fileURLWithPath:file_path_ns]; + + if (IsOSSnowLeopardOrEarlier()) { + // Do a pre-emptive unexclude by-path since by-path exclusions may have + // been performed on this file in the past. This feature is available to + // administrative users in 10.5 and 10.6, but is restricted to the root + // user in 10.7. Since it logs messages to the console in 10.7 and + // wouldn't work anyway, avoid calling it altogether in that version. + // + // TODO(mrossetti) or TODO(mark): remove on the trunk after September + // 2011, M15. http://crbug.com/86104 + CSBackupSetItemExcluded(base::mac::NSToCFCast(file_url), FALSE, TRUE); + } + // When excludeByPath is true the application must be running with root // privileges (admin for 10.6 and earlier) but the URL does not have to // already exist. When excludeByPath is false the URL must already exist but @@ -256,7 +266,7 @@ bool SetFileBackupExclusion(const FilePath& file_path) { // non-root (or admin) users don't get their TimeMachine drive filled up with // unnecessary backups. OSStatus os_err = - CSBackupSetItemExcluded(base::mac::NSToCFCast(url), TRUE, FALSE); + CSBackupSetItemExcluded(base::mac::NSToCFCast(file_url), TRUE, FALSE); if (os_err != noErr) { LOG(WARNING) << "Failed to set backup exclusion for file '" << file_path.value().c_str() << "' with error " |