diff mbox series

[iproute2,1/1] ip: initialize FILE pointer in ip-monitor

Message ID 1506453236-7034-1-git-send-email-mrv@mojatatu.com
State Superseded, archived
Delegated to: stephen hemminger
Headers show
Series [iproute2,1/1] ip: initialize FILE pointer in ip-monitor | expand

Commit Message

Roman Mashak Sept. 26, 2017, 7:13 p.m. UTC
Since FILE *_fp was not explicitly initialized, all the consequent print_*()
calls were failing.

Signed-off-by: Roman Mashak <mrv@mojatatu.com>
---
 ip/ipmonitor.c | 3 +++
 1 file changed, 3 insertions(+)

Comments

Stephen Hemminger Sept. 27, 2017, 7:36 a.m. UTC | #1
On Tue, 26 Sep 2017 15:13:56 -0400
Roman Mashak <mrv@mojatatu.com> wrote:

> Since FILE *_fp was not explicitly initialized, all the consequent print_*()
> calls were failing.
> 
> Signed-off-by: Roman Mashak <mrv@mojatatu.com>

This works, but the later patch by Julien Fortien which gets rid of the
FILE * argument all together is a cleaner solution. I will skip this
patch and apply that one.
diff mbox series

Patch

diff --git a/ip/ipmonitor.c b/ip/ipmonitor.c
index 3171d47..f4d502a 100644
--- a/ip/ipmonitor.c
+++ b/ip/ipmonitor.c
@@ -284,6 +284,9 @@  int do_ipmonitor(int argc, char **argv)
 	if (lnsid) {
 		groups |= nl_mgrp(RTNLGRP_NSID);
 	}
+
+	new_json_obj(json, stdout);
+
 	if (file) {
 		FILE *fp;
 		int err;