fix potential wrong error code in posix socket