mirror of
https://github.com/amadvance/snapraid.git
synced 2026-12-01 20:36:38 -05:00
Make sgetbs() return the number of characters read on success
This commit is contained in:
parent
97419fb67f
commit
969cb5ca31
5 changed files with 35 additions and 5 deletions
|
|
@ -691,7 +691,7 @@ int sgetble32(STREAM* f, uint32_t* value)
|
|||
return 0;
|
||||
}
|
||||
|
||||
int sgetbs(STREAM* f, char* str, size_t size)
|
||||
ssize_t sgetbs(STREAM* f, char* str, size_t size)
|
||||
{
|
||||
uint64_t len;
|
||||
|
||||
|
|
@ -709,7 +709,13 @@ int sgetbs(STREAM* f, char* str, size_t size)
|
|||
|
||||
str[len] = 0;
|
||||
|
||||
return sread(f, str, len);
|
||||
if (sread(f, str, len) != 0) {
|
||||
/* LCOV_EXCL_START */
|
||||
return -1;
|
||||
/* LCOV_EXCL_STOP */
|
||||
}
|
||||
|
||||
return len;
|
||||
}
|
||||
|
||||
int swrite_uncached(const void* void_data, size_t size, STREAM* f)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue