Closed alexeys85 closed 2 years ago
Nice catch! You say "at least here", I cannot seem to find any other cases of recv()
and size_t
, are you perhaps referring to uses of read()
which stores result in int
?
Well, I haven't found this issue anywhere else as well, just wanted to say that where are could be more places for you to check :)
While at it, is it really necessary to force errno
to be ECONNRESET
in case of 0
or negative return value?
OK, I see. Well then I didn't miss anything.
Re: ECONNRESET
; yeah it was chosen to signal EOF (when recv()
return 0) back to ipc_read()
. On -1
it should return the errno
of the syscall -- as you pointed out in this report.
The return type of
recv
call isssize_t
, at least on linux, somewhere else it could be justint
. And-1
return value indicates about error. But at least here: https://github.com/troglobit/smcroute/blob/08289187975894a5748a3a478a0fb9f900274722/src/ipc.c#L176 it casts tosize_t
which converts-1
to non error value.