Changing linux code to throw appropriate serial port errors if the select() call returns -1