diff --git a/usr.sbin/syslogd/syslogd.c b/usr.sbin/syslogd/syslogd.c index dea71b03cb4e..fa669c2c5b24 100644 --- a/usr.sbin/syslogd/syslogd.c +++ b/usr.sbin/syslogd/syslogd.c @@ -477,7 +477,15 @@ main(int argc, char *argv[]) break; case 'b': bflag = 1; - if ((p = strchr(optarg, ':')) == NULL) { + p = strchr(optarg, ']'); + if (p != NULL) + p = strchr(p + 1, ':'); + else { + p = strchr(optarg, ':'); + if (p != NULL && strchr(p + 1, ':') != NULL) + p = NULL; /* backward compatibility */ + } + if (p == NULL) { /* A hostname or filename only. */ addpeer(&(struct peer){ .pe_name = optarg,