I'm working with legacy code. This code calls a "read" on a socket. If the read function returns a 0 or below, the calling function will throw an error.
n = read(sock, &buff[bytesRead], bytesToRead - bytesRead);
if (n <= 0) {
syslog(LOG_CRIT, "ReadFromSocket: read() failed, errno=%d\n", errno);
return FALSE;
}
However, I've noticed that this function is throwing an error with the "errno" = 0.
I'm curious if I'm running into an edge case where the read function is returning a 0, which is incorrectly being interpreted as an error.
Does a return value of 0 indicate an actual error?