main: allow NULL argument of helper function

This commit is contained in:
Thomas Schoebel-Theuer 2020-02-28 07:44:54 +01:00
parent acae344ccf
commit 57612397c2
1 changed files with 4 additions and 1 deletions

View File

@ -1081,12 +1081,15 @@ int parse_logfile_name(const char *str, int *seq, const char **host)
int len_host;
*seq = 0;
*host = NULL;
if (host)
*host = NULL;
count = sscanf(str, "log-%d-%n", seq, &len);
if (unlikely(count != 1)) {
MARS_ERR("bad logfile name '%s', count=%d, len=%d\n", str, count, len);
return 0;
} else if (!host) {
return -1;
}
_host = brick_strdup(str + len);