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 433 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
444 const unsigned len = strlen(pair); | 444 const unsigned len = strlen(pair); |
445 ret[k++] = scratch; | 445 ret[k++] = scratch; |
446 memcpy(scratch, pair, len + 1); | 446 memcpy(scratch, pair, len + 1); |
447 scratch += len + 1; | 447 scratch += len + 1; |
448 } | 448 } |
449 } | 449 } |
450 | 450 |
451 // Now handle new elements | 451 // Now handle new elements |
452 for (environment_vector::const_iterator | 452 for (environment_vector::const_iterator |
453 j = changes.begin(); j != changes.end(); j++) { | 453 j = changes.begin(); j != changes.end(); j++) { |
454 if (j->second.size() == 0) | 454 if (j->second.empty()) |
455 continue; | 455 continue; |
456 | 456 |
457 bool found = false; | 457 bool found = false; |
458 for (unsigned i = 0; env[i]; i++) { | 458 for (unsigned i = 0; env[i]; i++) { |
459 const char *const pair = env[i]; | 459 const char *const pair = env[i]; |
460 const char *const equals = strchr(pair, '='); | 460 const char *const equals = strchr(pair, '='); |
461 if (!equals) | 461 if (!equals) |
462 continue; | 462 continue; |
463 const unsigned keylen = equals - pair; | 463 const unsigned keylen = equals - pair; |
464 if (keylen == j->first.size() && | 464 if (keylen == j->first.size() && |
(...skipping 516 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
981 const ProcessFilter* filter) { | 981 const ProcessFilter* filter) { |
982 bool exited_cleanly = | 982 bool exited_cleanly = |
983 WaitForProcessesToExit(executable_name, wait_milliseconds, | 983 WaitForProcessesToExit(executable_name, wait_milliseconds, |
984 filter); | 984 filter); |
985 if (!exited_cleanly) | 985 if (!exited_cleanly) |
986 KillProcesses(executable_name, exit_code, filter); | 986 KillProcesses(executable_name, exit_code, filter); |
987 return exited_cleanly; | 987 return exited_cleanly; |
988 } | 988 } |
989 | 989 |
990 } // namespace base | 990 } // namespace base |
OLD | NEW |