Process SIGINT and SIGTERM only in safe places.