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

Unified Diff: base/linux_util.cc

Issue 3186028: Make crash reporting client_id accessible through child_process_logging. (Closed) Base URL: http://src.chromium.org/git/chromium.git
Patch Set: address mark's feedback Created 10 years, 4 months 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 | « base/linux_util.h ('k') | chrome/app/breakpad_linux.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/linux_util.cc
diff --git a/base/linux_util.cc b/base/linux_util.cc
index b8c78e452367a4e798b61ee105ccdead1f0e9511..246c95cd5d4d0cabfaab6f97f0e9f8ec9b04d346 100644
--- a/base/linux_util.cc
+++ b/base/linux_util.cc
@@ -126,9 +126,12 @@ bool ProcPathGetInode(ino_t* inode_out, const char* path, bool log = false) {
namespace base {
+// Account for the terminating null character.
+static const int kDistroSize = 128 + 1;
+
// We use this static string to hold the Linux distro info. If we
// crash, the crash handler code will send this in the crash dump.
-std::string linux_distro =
+char g_linux_distro[kDistroSize] =
#if defined(OS_CHROMEOS)
"CrOS";
#else // if defined(OS_LINUX)
@@ -137,7 +140,7 @@ std::string linux_distro =
std::string GetLinuxDistro() {
#if defined(OS_CHROMEOS)
- return linux_distro;
+ return g_linux_distro;
#elif defined(OS_LINUX)
LinuxDistroHelper* distro_state_singleton = LinuxDistroHelper::Get();
LinuxDistroState state = distro_state_singleton->State();
@@ -154,25 +157,30 @@ std::string GetLinuxDistro() {
// lsb_release -d should return: Description:<tab>Distro Info
static const std::string field = "Description:\t";
if (output.compare(0, field.length(), field) == 0) {
- linux_distro = output.substr(field.length());
- TrimWhitespaceASCII(linux_distro, TRIM_ALL, &linux_distro);
+ SetLinuxDistro(output.substr(field.length()));
}
}
distro_state_singleton->CheckFinished();
- return linux_distro;
+ return g_linux_distro;
} else if (STATE_CHECK_STARTED == state) {
// If the distro check above is in progress in some other thread, we're
// not going to wait for the results.
return "Unknown";
} else {
// In STATE_CHECK_FINISHED, no more writing to |linux_distro|.
- return linux_distro;
+ return g_linux_distro;
}
#else
NOTIMPLEMENTED();
#endif
}
+void SetLinuxDistro(const std::string& distro) {
+ std::string trimmed_distro;
+ TrimWhitespaceASCII(distro, TRIM_ALL, &trimmed_distro);
+ base::strlcpy(g_linux_distro, trimmed_distro.c_str(), kDistroSize);
+}
+
bool FileDescriptorGetInode(ino_t* inode_out, int fd) {
DCHECK(inode_out);
« no previous file with comments | « base/linux_util.h ('k') | chrome/app/breakpad_linux.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698