Improve error reporting in rtsock.c
MFC after: 3 days
(cherry picked from commit 758c9d54d44f8ce957570b8c2ef6d1b3f28a792d)