qemu-trivial
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-trivial] [PATCH v7] block/vvfat: assert return value of fopen whic


From: zhanghailiang
Subject: [Qemu-trivial] [PATCH v7] block/vvfat: assert return value of fopen which may fail
Date: Mon, 18 Aug 2014 16:00:31 +0800

From: Li Liu <address@hidden>

fopen() may return NULL which will cause setbuf() segmentfault

Signed-off-by: zhanghailiang <address@hidden>
Signed-off-by: Li Liu <address@hidden>
---
 block/vvfat.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/block/vvfat.c b/block/vvfat.c
index 70176b1..62023e1 100644
--- a/block/vvfat.c
+++ b/block/vvfat.c
@@ -1084,6 +1084,7 @@ static int vvfat_open(BlockDriverState *bs, QDict 
*options, int flags,
 
 DLOG(if (stderr == NULL) {
     stderr = fopen("vvfat.log", "a");
+    assert(stderr);
     setbuf(stderr, NULL);
 })
 
-- 
1.7.12.4





reply via email to

[Prev in Thread] Current Thread [Next in Thread]