| 475 | } |
| 476 | |
| 477 | int ErrnoFromStatus(const Status& status) { |
| 478 | const auto detail = status.detail(); |
| 479 | if (detail != nullptr) { |
| 480 | if (detail->type_id() == kErrnoDetailTypeId) { |
| 481 | return checked_cast<const ErrnoDetail&>(*detail).errnum(); |
| 482 | } |
| 483 | #if _WIN32 |
| 484 | if (detail->type_id() == kWinErrorDetailTypeId) { |
| 485 | return checked_cast<const WinErrorDetail&>(*detail).equivalent_errno(); |
| 486 | } |
| 487 | #endif |
| 488 | } |
| 489 | return 0; |
| 490 | } |
| 491 | |
| 492 | int WinErrorFromStatus(const Status& status) { |
| 493 | #if _WIN32 |