Back-port the test from commit 27795cf from the master branch ("unix: fix accept() EMFILE error handling").
27795cf