diff options
author | gspencer@chromium.org <gspencer@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-12-03 17:37:54 +0000 |
---|---|---|
committer | gspencer@chromium.org <gspencer@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-12-03 17:37:54 +0000 |
commit | 723571af3c1a86aa14a68bce2511f3dad399287f (patch) | |
tree | c77043d78d5eb7eb1437071561fce7c8ad9b4a5d /chrome/common/logging_chrome.cc | |
parent | 0868ee7ae6d7fbb63ab85dfeafa34d724f9a1b45 (diff) | |
download | chromium_src-723571af3c1a86aa14a68bce2511f3dad399287f.zip chromium_src-723571af3c1a86aa14a68bce2511f3dad399287f.tar.gz chromium_src-723571af3c1a86aa14a68bce2511f3dad399287f.tar.bz2 |
Start using file_util symlink code, now that it's available.
In CL http://codereview.chromium.org/5349007
I added some base API for manipulating symlinks (since I needed it for some ChromeOS code and noticed that other places could use it too), and this just starts using that API.
BUG=none
TEST=Ran ui_tests, passed trybots.
Review URL: http://codereview.chromium.org/5286010
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@68181 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/common/logging_chrome.cc')
-rw-r--r-- | chrome/common/logging_chrome.cc | 12 |
1 files changed, 3 insertions, 9 deletions
diff --git a/chrome/common/logging_chrome.cc b/chrome/common/logging_chrome.cc index 196c581..e5d442c 100644 --- a/chrome/common/logging_chrome.cc +++ b/chrome/common/logging_chrome.cc @@ -164,23 +164,17 @@ FilePath SetUpSymlinkIfNeeded(const FilePath& symlink_path, bool new_log) { target_path = GenerateTimestampedName(symlink_path, base::Time::Now()); // We don't care if the unlink fails; we're going to continue anyway. - if (unlink(symlink_path.value().c_str()) == -1) { + if (::unlink(symlink_path.value().c_str()) == -1) { if (symlink_exists) // only warn if we might expect it to succeed. PLOG(WARNING) << "Unable to unlink " << symlink_path.value(); } - if (symlink(target_path.value().c_str(), - symlink_path.value().c_str()) == -1) { + if (!file_util::CreateSymbolicLink(target_path, symlink_path)) { PLOG(ERROR) << "Unable to create symlink " << symlink_path.value() << " pointing at " << target_path.value(); } } else { - char buf[PATH_MAX]; - ssize_t count = readlink(symlink_path.value().c_str(), buf, arraysize(buf)); - if (count > 0) { - target_path = FilePath(FilePath::StringType(buf, count)); - } else { + if (!file_util::ReadSymbolicLink(symlink_path, &target_path)) PLOG(ERROR) << "Unable to read symlink " << symlink_path.value(); - } } return target_path; } |