Avoid race condition, consolidate check into stat() exception block.