]> git.proxmox.com Git - mirror_iproute2.git/commit
ss: Fix rendering of continuous output (-E, --events)
authorStefano Brivio <sbrivio@redhat.com>
Fri, 23 Mar 2018 08:37:05 +0000 (09:37 +0100)
committerStephen Hemminger <stephen@networkplumber.org>
Tue, 27 Mar 2018 16:09:38 +0000 (09:09 -0700)
commit32ea3d54b474b25f1e959d7d43632d261afbb283
tree432fcff970e34dfaf15b684020080650dd8fafc9
parent79f49f58aaefe11f677c8e072557b834a19f47f3
ss: Fix rendering of continuous output (-E, --events)

Roman Mashak reported that ss currently shows no output when it
should continuously report information about terminated sockets
(-E, --events switch).

This happens because I missed this case in 691bd854bf4a ("ss:
Buffer raw fields first, then render them as a table") and the
rendering function is simply not called.

To fix this, we need to:

- call render() every time we need to display new socket events
  from generic_show_sock(), which is only used to follow events.
  Always call it even if specific socket display functions
  return errors to ensure we clean up buffers

- get the screen width every time we have new events to display,
  thus factor out getting the screen width from main() into a
  function we'll call whenever we calculate columns width

- reset the current field pointer after rendering, more output
  might come after render() is called

Reported-by: Roman Mashak <mrv@mojatatu.com>
Fixes: 691bd854bf4a ("ss: Buffer raw fields first, then render them as a table")
Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
Tested-by: Roman Mashak <mrv@mojatatu.com>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
misc/ss.c