zhanghailiang writes: > From: Li Liu <john.li...@huawei.com> > > Give a warning message if fopen() failed to open the log file. > > Signed-off-by: zhanghailiang <zhang.zhanghaili...@huawei.com> > Signed-off-by: Li Liu <john.li...@huawei.com>
Reviewed-by: Alex Bennée <alex.ben...@linaro.org> > --- > tcg/tcg.c | 4 ++++ > 1 file changed, 4 insertions(+) > > diff --git a/tcg/tcg.c b/tcg/tcg.c > index c068990..8f50d2a 100644 > --- a/tcg/tcg.c > +++ b/tcg/tcg.c > @@ -2406,6 +2406,10 @@ static void dump_op_count(void) > int i; > FILE *f; > f = fopen("/tmp/op.log", "w"); > + if (f == NULL) { > + fprintf(stderr, "Failed to open /tmp/op.log\n"); > + return; > + } > for(i = INDEX_op_end; i < NB_OPS; i++) { > fprintf(f, "%s %" PRId64 "\n", tcg_op_defs[i].name, > tcg_table_op_count[i]); > } -- Alex Bennée