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; |
} |