OLD | NEW |
1 // Copyright 2014 The Crashpad Authors. All rights reserved. | 1 // Copyright 2014 The Crashpad Authors. All rights reserved. |
2 // | 2 // |
3 // Licensed under the Apache License, Version 2.0 (the "License"); | 3 // Licensed under the Apache License, Version 2.0 (the "License"); |
4 // you may not use this file except in compliance with the License. | 4 // you may not use this file except in compliance with the License. |
5 // You may obtain a copy of the License at | 5 // You may obtain a copy of the License at |
6 // | 6 // |
7 // http://www.apache.org/licenses/LICENSE-2.0 | 7 // http://www.apache.org/licenses/LICENSE-2.0 |
8 // | 8 // |
9 // Unless required by applicable law or agreed to in writing, software | 9 // Unless required by applicable law or agreed to in writing, software |
10 // distributed under the License is distributed on an "AS IS" BASIS, | 10 // distributed under the License is distributed on an "AS IS" BASIS, |
(...skipping 385 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
396 | 396 |
397 // Look up the server and check in with it by providing the token and port. | 397 // Look up the server and check in with it by providing the token and port. |
398 return RunClientInternal_SendCheckIn(service_name, token, port, right_type); | 398 return RunClientInternal_SendCheckIn(service_name, token, port, right_type); |
399 } | 399 } |
400 | 400 |
401 // static | 401 // static |
402 bool ChildPortHandshake::RunClientInternal_ReadPipe(int client_read_fd, | 402 bool ChildPortHandshake::RunClientInternal_ReadPipe(int client_read_fd, |
403 child_port_token_t* token, | 403 child_port_token_t* token, |
404 std::string* service_name) { | 404 std::string* service_name) { |
405 // Read the token from the pipe. | 405 // Read the token from the pipe. |
406 if (!LoggingReadFile(client_read_fd, token, sizeof(*token))) { | 406 if (!LoggingReadFileExactly(client_read_fd, token, sizeof(*token))) { |
407 return false; | 407 return false; |
408 } | 408 } |
409 | 409 |
410 // Read the service name from the pipe. | 410 // Read the service name from the pipe. |
411 uint32_t service_name_length; | 411 uint32_t service_name_length; |
412 if (!LoggingReadFile( | 412 if (!LoggingReadFileExactly( |
413 client_read_fd, &service_name_length, sizeof(service_name_length))) { | 413 client_read_fd, &service_name_length, sizeof(service_name_length))) { |
414 return false; | 414 return false; |
415 } | 415 } |
416 | 416 |
417 service_name->resize(service_name_length); | 417 service_name->resize(service_name_length); |
418 if (!service_name->empty() && | 418 if (!service_name->empty() && |
419 !LoggingReadFile( | 419 !LoggingReadFileExactly( |
420 client_read_fd, &(*service_name)[0], service_name_length)) { | 420 client_read_fd, &(*service_name)[0], service_name_length)) { |
421 return false; | 421 return false; |
422 } | 422 } |
423 | 423 |
424 return true; | 424 return true; |
425 } | 425 } |
426 | 426 |
427 // static | 427 // static |
428 bool ChildPortHandshake::RunClientInternal_SendCheckIn( | 428 bool ChildPortHandshake::RunClientInternal_SendCheckIn( |
429 const std::string& service_name, | 429 const std::string& service_name, |
(...skipping 12 matching lines...) Expand all Loading... |
442 server_port.get(), token, port, right_type); | 442 server_port.get(), token, port, right_type); |
443 if (kr != KERN_SUCCESS) { | 443 if (kr != KERN_SUCCESS) { |
444 MACH_LOG(ERROR, kr) << "child_port_check_in"; | 444 MACH_LOG(ERROR, kr) << "child_port_check_in"; |
445 return false; | 445 return false; |
446 } | 446 } |
447 | 447 |
448 return true; | 448 return true; |
449 } | 449 } |
450 | 450 |
451 } // namespace crashpad | 451 } // namespace crashpad |
OLD | NEW |