struct rtnl_ctrl_data *ctrl,
struct nlmsghdr *n, void *arg)
{
- FILE *fp = (FILE*)arg;
+ FILE *fp = (FILE *)arg;
if (timestamp)
print_timestamp(fp);
{
struct rtnl_handle rth;
char *file = NULL;
- unsigned groups = nl_mgrp(RTNLGRP_TC);
+ unsigned int groups = nl_mgrp(RTNLGRP_TC);
while (argc > 0) {
if (matches(*argv, "file") == 0) {
}
if (file) {
- FILE *fp;
- fp = fopen(file, "r");
+ FILE *fp = fopen(file, "r");
+ int ret;
+
if (fp == NULL) {
perror("Cannot fopen");
exit(-1);
}
- return rtnl_from_file(fp, accept_tcmsg, (void*)stdout);
+
+ ret = rtnl_from_file(fp, accept_tcmsg, stdout);
+ fclose(fp);
+ return ret;
}
if (rtnl_open(&rth, groups) < 0)
ll_init_map(&rth);
- if (rtnl_listen(&rth, accept_tcmsg, (void*)stdout) < 0) {
+ if (rtnl_listen(&rth, accept_tcmsg, (void *)stdout) < 0) {
rtnl_close(&rth);
exit(2);
}