Skip to content

Commit 05f18a2

Browse files
committed
fix multiple fflush might miss some branch and html output
1 parent bd878c0 commit 05f18a2

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

src/output.c

+2-3
Original file line numberDiff line numberDiff line change
@@ -537,6 +537,7 @@ void print_values(unsigned int y,unsigned int x,const char *if_name,t_iface_spee
537537
values2str(1,stats,full_stats,multiplier,buffer,49),
538538
((stats.errors.out || stats.errors.in) && output_unit!=ERRORS_OUT) ? "error" : "dummy" );
539539
fprintf(tmp_out_file,"%s</span></td><tr>\n",values2str(2,stats,full_stats,multiplier,buffer,49));
540+
fflush(tmp_out_file);
540541
break;
541542
#endif
542543
#ifdef CSV
@@ -565,7 +566,6 @@ void print_values(unsigned int y,unsigned int x,const char *if_name,t_iface_spee
565566
#endif
566567
fprintf(tmp_out_file,"%.2f%c%.2f%c%.2f%c%llu%c%llu\n",(double)(stats_csv->bytes.out*multiplier*8),csv_char,(double)(stats_csv->bytes.in*multiplier*8),
567568
csv_char,(double)((stats_csv->bytes.out+stats_csv->bytes.in)*multiplier*8),csv_char,stats_csv->bytes.in*8,csv_char,stats_csv->bytes.out*8);
568-
fflush(tmp_out_file);
569569
} else {
570570
stats_csv = &full_stats.sum;
571571
#if !NETSTAT_BSD_BYTES && !NETSTAT_NETBSD && NETSTAT
@@ -576,7 +576,6 @@ void print_values(unsigned int y,unsigned int x,const char *if_name,t_iface_spee
576576
/* show packets and errors */
577577
fprintf(tmp_out_file,"%llu%c%llu%c%llu",stats_csv->packets.out,csv_char,stats_csv->packets.in,csv_char,(stats_csv->packets.out+stats_csv->packets.in));
578578
fprintf(tmp_out_file,"%c%llu%c%llu\n",csv_char,stats_csv->errors.out,csv_char,stats_csv->errors.in);
579-
fflush(tmp_out_file);
580579
}
581580
} else { /* MAX_OUT or AVG_OUT */
582581
if (output_type == MAX_OUT)
@@ -600,8 +599,8 @@ void print_values(unsigned int y,unsigned int x,const char *if_name,t_iface_spee
600599
/* show packets/s and errors/s */
601600
fprintf(tmp_out_file,"%.2Lf%c%.2Lf%c%.2Lf",stats_csv_d.packets.out,csv_char,stats_csv_d.packets.in,csv_char,stats_csv_d.packets.total);
602601
fprintf(tmp_out_file,"%c%.2Lf%c%.2Lf\n",csv_char,stats_csv_d.errors.out,csv_char,stats_csv_d.errors.in);
603-
fflush(tmp_out_file);
604602
}
603+
fflush(tmp_out_file);
605604
break;
606605
#endif
607606
}

0 commit comments

Comments
 (0)