Rework serc_safe into serc_safe_open

Closes a small race condition that could occur between checking if serc is safe and reading it. Also fix HAVE_STAT check while here.