:checkhealth : validate 'runtimepath' (#7526)

This commit is contained in:
Justin M. Keyes
2017-11-10 22:37:54 +01:00
committed by GitHub
parent 314ff440f7
commit f5d4da0144
3 changed files with 19 additions and 8 deletions

View File

@@ -22883,11 +22883,15 @@ void ex_checkhealth(exarg_T *eap)
const char *vimruntime_env = os_getenv("VIMRUNTIME");
if (vimruntime_env == NULL) {
EMSG(_("E5009: $VIMRUNTIME is empty or unset"));
return;
} else {
EMSG2(_("E5009: Invalid $VIMRUNTIME: %s"), os_getenv("VIMRUNTIME"));
return;
bool rtp_ok = NULL != strstr((char *)p_rtp, vimruntime_env);
if (rtp_ok) {
EMSG2(_("E5009: Invalid $VIMRUNTIME: %s"), vimruntime_env);
} else {
EMSG(_("E5009: Invalid 'runtimepath'"));
}
}
return;
}
size_t bufsize = STRLEN(eap->arg) + sizeof("call health#check('')");