OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include <dirent.h> | 5 #include <dirent.h> |
6 #include <errno.h> | 6 #include <errno.h> |
7 #include <fcntl.h> | 7 #include <fcntl.h> |
8 #include <signal.h> | 8 #include <signal.h> |
9 #include <stdlib.h> | 9 #include <stdlib.h> |
10 #include <sys/resource.h> | 10 #include <sys/resource.h> |
(...skipping 357 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
368 // First assume that all of the current environment will be included. | 368 // First assume that all of the current environment will be included. |
369 for (unsigned i = 0; env[i]; i++) { | 369 for (unsigned i = 0; env[i]; i++) { |
370 const char *const pair = env[i]; | 370 const char *const pair = env[i]; |
371 count++; | 371 count++; |
372 size += strlen(pair) + 1 /* terminating NUL */; | 372 size += strlen(pair) + 1 /* terminating NUL */; |
373 } | 373 } |
374 | 374 |
375 for (environment_vector::const_iterator | 375 for (environment_vector::const_iterator |
376 j = changes.begin(); j != changes.end(); j++) { | 376 j = changes.begin(); j != changes.end(); j++) { |
377 bool found = false; | 377 bool found = false; |
378 const char *pair; | 378 const char *pair = NULL; // clang pr9062 |
379 | 379 |
380 for (unsigned i = 0; env[i]; i++) { | 380 for (unsigned i = 0; env[i]; i++) { |
381 pair = env[i]; | 381 pair = env[i]; |
382 const char *const equals = strchr(pair, '='); | 382 const char *const equals = strchr(pair, '='); |
383 if (!equals) | 383 if (!equals) |
384 continue; | 384 continue; |
385 const unsigned keylen = equals - pair; | 385 const unsigned keylen = equals - pair; |
386 if (keylen == j->first.size() && | 386 if (keylen == j->first.size() && |
387 memcmp(pair, j->first.data(), keylen) == 0) { | 387 memcmp(pair, j->first.data(), keylen) == 0) { |
388 found = true; | 388 found = true; |
(...skipping 516 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
905 const ProcessFilter* filter) { | 905 const ProcessFilter* filter) { |
906 bool exited_cleanly = | 906 bool exited_cleanly = |
907 WaitForProcessesToExit(executable_name, wait_milliseconds, | 907 WaitForProcessesToExit(executable_name, wait_milliseconds, |
908 filter); | 908 filter); |
909 if (!exited_cleanly) | 909 if (!exited_cleanly) |
910 KillProcesses(executable_name, exit_code, filter); | 910 KillProcesses(executable_name, exit_code, filter); |
911 return exited_cleanly; | 911 return exited_cleanly; |
912 } | 912 } |
913 | 913 |
914 } // namespace base | 914 } // namespace base |
OLD | NEW |