select() returns -1 in case of errors, not 0
Serial port logger which can be used to print to stdout.
Brought to you by:
jame
I believe line 146 of ttylog.c should be :
if (retval > 0)
instead of ;
if (retval)
This because under linux "man select" reads "On error, -1 is returned".
On a side note, I also believe that line 137 and 138 of the same file are superfluous, as rfds will be set in the while loop anyway.
A return of '0' (zero) is also valid but not an error; so while that line may need to be changed, just changing it to '> -0' may not be enough.
This will need more investigation.
Note that the 'select' in question is now at line 185 and its associated 'if (retval)' line is still right after it at line 186.
Note that it is at line 215 now.