[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-trivial] [PATCH v6 09/10] tcg: check return value of fopen()
From: |
zhanghailiang |
Subject: |
[Qemu-trivial] [PATCH v6 09/10] tcg: check return value of fopen() |
Date: |
Thu, 14 Aug 2014 15:29:20 +0800 |
From: Li Liu <address@hidden>
Give a warning message if fopen() failed to open the log file.
Reviewed-by: Alex Bennée <address@hidden>
Signed-off-by: zhanghailiang <address@hidden>
Signed-off-by: Li Liu <address@hidden>
---
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]);
}
--
1.7.12.4
- [Qemu-trivial] [PATCH v6 05/10] util/path: Use the GLib memory allocation routines, (continued)
[Qemu-trivial] [PATCH v6 03/10] virtio-blk: fix reference a pointer which might be freed, zhanghailiang, 2014/08/14
Re: [Qemu-trivial] [PATCH v6 03/10] virtio-blk: fix reference a pointer which might be freed, Michael Tokarev, 2014/08/18