Commit 270d4c8d authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

mmap: handle I/O errors as fatal

parent f77a6c48
...@@ -213,8 +213,7 @@ static block_t *Block (access_t *p_access) ...@@ -213,8 +213,7 @@ static block_t *Block (access_t *p_access)
msg_Err (p_access, "memory mapping failed (%m)"); msg_Err (p_access, "memory mapping failed (%m)");
intf_UserFatal (p_access, false, _("File reading failed"), intf_UserFatal (p_access, false, _("File reading failed"),
_("VLC could not read the file.")); _("VLC could not read the file."));
msleep (INPUT_ERROR_SLEEP); goto fatal;
return NULL;
} }
#ifdef HAVE_POSIX_MADVISE #ifdef HAVE_POSIX_MADVISE
posix_madvise (addr, length, POSIX_MADV_SEQUENTIAL); posix_madvise (addr, length, POSIX_MADV_SEQUENTIAL);
...@@ -222,7 +221,7 @@ static block_t *Block (access_t *p_access) ...@@ -222,7 +221,7 @@ static block_t *Block (access_t *p_access)
block_t *block = block_mmap_Alloc (addr, length); block_t *block = block_mmap_Alloc (addr, length);
if (block == NULL) if (block == NULL)
return NULL; goto fatal;
block->p_buffer += inner_offset; block->p_buffer += inner_offset;
block->i_buffer -= inner_offset; block->i_buffer -= inner_offset;
...@@ -245,6 +244,10 @@ static block_t *Block (access_t *p_access) ...@@ -245,6 +244,10 @@ static block_t *Block (access_t *p_access)
p_access->info.i_pos = outer_offset + length; p_access->info.i_pos = outer_offset + length;
return block; return block;
fatal:
p_access->info.b_eof = true;
return NULL;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment