mirror of
https://gitlab.com/sortix/sortix.git
synced 2023-02-13 20:55:38 -05:00
Fix fread/fwrite zero division when size is zero.
This commit is contained in:
parent
0100b61855
commit
b8f12a6856
2 changed files with 4 additions and 0 deletions
|
@ -40,6 +40,8 @@ size_t fread_unlocked(void* ptr,
|
|||
|
||||
unsigned char* buf = (unsigned char*) ptr;
|
||||
size_t count = element_size * num_elements;
|
||||
if ( count == 0 )
|
||||
return num_elements;
|
||||
|
||||
if ( fp->buffer_mode == _IONBF )
|
||||
{
|
||||
|
|
|
@ -40,6 +40,8 @@ size_t fwrite_unlocked(const void* ptr,
|
|||
|
||||
const unsigned char* buf = (const unsigned char*) ptr;
|
||||
size_t count = element_size * num_elements;
|
||||
if ( count == 0 )
|
||||
return num_elements;
|
||||
|
||||
if ( fp->buffer_mode == _IONBF )
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue