This fixes a bad readlink call that was causing some tests to fail.

BUG=none (Fixing build)
TEST=Ran all WorkerTest ui tests on linux (with chromeos=1 and without), and they succeeded.

Review URL: http://codereview.chromium.org/4128013

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@64299 0039d316-1c4b-4281-b951-d872f2087c98
diff --git a/chrome/common/logging_chrome.cc b/chrome/common/logging_chrome.cc
index 9bbb878..116b37a 100644
--- a/chrome/common/logging_chrome.cc
+++ b/chrome/common/logging_chrome.cc
@@ -151,6 +151,8 @@
 }
 
 FilePath SetUpSymlinkIfNeeded(const FilePath& symlink_path, bool new_log) {
+  DCHECK(!symlink_path.empty());
+
   // If not starting a new log, then just log through the existing
   // symlink, but if the symlink doesn't exist, create it.  If
   // starting a new log, then delete the old symlink and make a new
@@ -170,10 +172,10 @@
                   << " pointing at " << target_path.value();
     }
   } else {
-    char buf[1024];
-    size_t count = readlink(target_path.value().c_str(), buf, sizeof(buf));
+    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));
+      target_path = FilePath(FilePath::StringType(buf, count));
     } else {
       PLOG(ERROR) << "Unable to read symlink " << symlink_path.value();
     }