[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [Qemu-trivial] [PATCH v6 09/10] tcg: check return value
From: |
Michael Tokarev |
Subject: |
Re: [Qemu-devel] [Qemu-trivial] [PATCH v6 09/10] tcg: check return value of fopen() |
Date: |
Fri, 15 Aug 2014 19:03:06 +0400 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Icedove/24.7.0 |
14.08.2014 14:33, Michael S. Tsirkin wrote:
> On Thu, Aug 14, 2014 at 03:29:20PM +0800, zhanghailiang wrote:
>> 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");
Gosh. So why are we still use fixed filenames in /tmp?????
Every such use is a potential security holw... :( Ughm.
Can't we get rid of this somehow, by requiring a filename
parameter for example?
Thanks,
/mjt
>> + if (f == NULL) {
>
> if (!f) please.
>
>> + fprintf(stderr, "Failed to open /tmp/op.log\n");
> Maybe add "for writing. Logging op count will be disabled.".
>
>> + 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-devel] [PATCH v6 02/10] monitor: fix access freed memory, zhanghailiang, 2014/08/14
[Qemu-devel] [PATCH v6 08/10] tests/bios-tables-test: check the value returned by fopen(), zhanghailiang, 2014/08/14