remove repeating code for make fd nonblock