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

Unified Diff: ipc/ipc_logging.cc

Issue 2821028: Up the warnings in ipc (take 2)... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 10 years, 5 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 | « ipc/ipc_fuzzing_tests.cc ('k') | ipc/ipc_message_utils.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ipc/ipc_logging.cc
===================================================================
--- ipc/ipc_logging.cc (revision 53465)
+++ ipc/ipc_logging.cc (working copy)
@@ -49,7 +49,17 @@
sender_(NULL),
main_thread_(MessageLoop::current()),
consumer_(NULL) {
- if (getenv("CHROME_IPC_LOGGING")) {
+#if defined(OS_WIN)
+ // getenv triggers an unsafe warning. Simply check how big of a buffer
+ // would be needed to fetch the value to see if the enviornment variable is
+ // set.
+ size_t requiredSize = 0;
+ getenv_s(&requiredSize, NULL, 0, "CHROME_IPC_LOGGING");
+ bool logging_env_var_set = (requiredSize != 0);
Mark Mentovai 2010/07/23 15:07:28 I don’t know if requiredSize will be 0 (or somethi
TVL 2010/07/23 15:26:55 From what msdn says, if you fetch the value, it wi
+#else // !defined(OS_WIN)
+ bool logging_env_var_set = (getenv("CHROME_IPC_LOGGING") != NULL);
Mark Mentovai 2010/07/23 15:07:28 You could have a const char* just outside the #if
+#endif //defined(OS_WIN)
+ if (logging_env_var_set) {
enabled_ = true;
enabled_on_stderr_ = true;
}
« no previous file with comments | « ipc/ipc_fuzzing_tests.cc ('k') | ipc/ipc_message_utils.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698