[PATCH 2/4] sock: fix decode_ifconf print error

JingPiao Chen chenjingpiao at gmail.com
Tue Dec 27 03:43:29 UTC 2016


* sock.c (decode_ifconf): Always print ifc_len, don't judge ifc_buf.
---
 sock.c | 15 +++++----------
 1 file changed, 5 insertions(+), 10 deletions(-)

diff --git a/sock.c b/sock.c
index 3e197ed..1c87927 100644
--- a/sock.c
+++ b/sock.c
@@ -140,24 +140,19 @@ decode_ifconf(struct tcb *tcp, const long addr)
 		tprints(", ");
 		if (umove_or_printaddr(tcp, addr, &ifc))
 			return RVAL_DECODED | 1;
-		if (ifc.ifc_buf) {
-			tprints("{");
-			print_ifc_len(ifc.ifc_len);
-		}
+		tprints("{");
+		print_ifc_len(ifc.ifc_len);
 		return 1;
 	}
 
 	if (syserror(tcp) || umove(tcp, addr, &ifc) < 0) {
-		if (ifc.ifc_buf)
-			tprints("}");
-		else
-			printaddr(addr);
+		tprints(", ");
+		printaddr(addr);
+		tprints("}");
 		return RVAL_DECODED | 1;
 	}
 
 	if (!ifc.ifc_buf) {
-		tprints("{");
-		print_ifc_len(ifc.ifc_len);
 		tprints(", NULL}");
 		return RVAL_DECODED | 1;
 	}
-- 
2.7.4





More information about the Strace-devel mailing list