Strip trailing slashes from masterserver address

This commit is contained in:
James R 2020-09-11 17:33:46 -07:00
parent c2ee6f3b95
commit 4e24ad125c

View file

@ -499,6 +499,19 @@ HMS_compare_mod_version (char *buffer, size_t buffer_size)
return ok; return ok;
} }
static char *
Strip_trailing_slashes (char *api)
{
char * p = &api[strlen(api)];
while (*--p == '/')
;
p[1] = '\0';
return api;
}
void void
HMS_set_api (char *api) HMS_set_api (char *api)
{ {
@ -507,7 +520,7 @@ HMS_set_api (char *api)
#endif #endif
{ {
free(hms_api); free(hms_api);
hms_api = api; hms_api = Strip_trailing_slashes(api);
} }
#ifdef HAVE_THREADS #ifdef HAVE_THREADS
I_unlock_mutex(hms_api_mutex); I_unlock_mutex(hms_api_mutex);