Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2479)

Unified Diff: chrome/common/logging_chrome.cc

Issue 5286010: Start using file_util symlink code, now that it's available. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Review change Created 10 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/process_singleton_linux.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/common/logging_chrome.cc
diff --git a/chrome/common/logging_chrome.cc b/chrome/common/logging_chrome.cc
index 196c581d0c666a32f8d11b11227d470cc52e47a8..e5d442c8e14cbecddf2dfd2974f913cabbc5536c 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;
}
« no previous file with comments | « chrome/browser/process_singleton_linux.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698