Fix handling of "host.domain" style server names in ov_server()

The old code would return "omain" rather than "domain" in this case.

Also remove unneccesary checks on the return value of get_server_itsname() -
this function already falls back to 'name' if 'itsname' isn't set yet.
This commit is contained in:
Kevin Easton
2016-04-06 22:22:39 +10:00
parent 74ee653d24
commit d19c050837

View File

@@ -279,20 +279,16 @@ char *ov_server(int server)
char *c;
char *d;
static char tmpstr[61];
char *string = get_server_itsname(server);
const char *string = get_server_itsname(server);
if (!string || !*string)
string = get_server_name(server);
if (!string || !*string)
return empty_string;
strlcpy(tmpstr, string, sizeof tmpstr);
if (!(c = strrchr(tmpstr,'.')))
return(string);
return tmpstr;
*c = 0;
if (!(d = strrchr(tmpstr, '.')))
d = ++c; /* Extract domain */
d = c; /* Extract domain */
d++;
return(d);
return d;
}
void serversay(int save, int from_server, const char *format, ...)