change return value of safe_snprintf to int, like snprintf