1
Fork 0
mirror of https://github.com/RGBCube/uutils-coreutils synced 2025-07-28 11:37:44 +00:00

who: limit the parts of split host to 2

This commit is contained in:
Knight 2016-08-20 19:53:31 +08:00
parent 34d2224098
commit fb53c019b4

View file

@ -441,7 +441,7 @@ impl Who {
let mut buf = vec![]; let mut buf = vec![];
let ut_host = ut.host(); let ut_host = ut.host();
let mut res = ut_host.split(':'); let mut res = ut_host.splitn(2, ':');
if let Some(h) = res.next() { if let Some(h) = res.next() {
if self.do_lookup { if self.do_lookup {
buf.push(ut.canon_host().unwrap_or(h.to_owned())); buf.push(ut.canon_host().unwrap_or(h.to_owned()));