aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefano Brivio <sbrivio@redhat.com>2017-10-31 18:47:55 +0100
committerStephen Hemminger <stephen@networkplumber.org>2017-11-01 22:10:52 +0100
commit22658ff53ab184bf446959fa0389717e82406b0d (patch)
treed459ac4541ba16ec539a61a251ffc660d3d91409
parent38509fa903d66cf13f3c8ca5010db820fb874064 (diff)
downloadiproute2-22658ff53ab184bf446959fa0389717e82406b0d.tar.gz
ss: Streamline process context printing in netlink_show_one()
There's no need to check 'pid_context' before calling free(). Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
-rw-r--r--misc/ss.c8
1 files changed, 2 insertions, 6 deletions
diff --git a/misc/ss.c b/misc/ss.c
index fa026eb0..fb80d841 100644
--- a/misc/ss.c
+++ b/misc/ss.c
@@ -3593,12 +3593,8 @@ static int netlink_show_one(struct filter *f,
else if (pid > 0)
getpidcon(pid, &pid_context);
- if (pid_context != NULL) {
- printf(" proc_ctx=%s", pid_context);
- free(pid_context);
- } else {
- printf(" proc_ctx=unavailable");
- }
+ printf(" proc_ctx=%s", pid_context ? : "unavailable");
+ free(pid_context);
}
if (show_details) {