preload: Factorize testing for path without changing errno