In one case, the function returns (-1). However, **size_t** is an unsigned type. How about using **ssize_t** instead of **size_t**?