mirror of
https://github.com/yuzu-emu/breakpad.git
synced 2024-11-27 18:54:15 +01:00
Set O_NONBLOCK for opening file to prevent hanging when file unavailable.
Bug: 277976345 Change-Id: Iddf55d8e172f98c76ae7167f609fb53c4c60fa48 Reviewed-on: https://chromium-review.googlesource.com/c/breakpad/breakpad/+/4437089 Reviewed-by: Joshua Peraza <jperaza@chromium.org>
This commit is contained in:
parent
b1775c56b2
commit
bd9d94c708
@ -61,8 +61,11 @@ MemoryMappedFile::~MemoryMappedFile() {
|
||||
|
||||
bool MemoryMappedFile::Map(const char* path, size_t offset) {
|
||||
Unmap();
|
||||
|
||||
int fd = sys_open(path, O_RDONLY, 0);
|
||||
// Based on https://pubs.opengroup.org/onlinepubs/7908799/xsh/open.html
|
||||
// If O_NONBLOCK is set: The open() function will return without blocking
|
||||
// for the device to be ready or available. Setting this value will provent
|
||||
// hanging if file is not avilable.
|
||||
int fd = sys_open(path, O_RDONLY | O_NONBLOCK, 0);
|
||||
if (fd == -1) {
|
||||
return false;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user