[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH v2] exec: make -mem-path filenames deterministic
From: |
Andreas Färber |
Subject: |
Re: [Qemu-devel] [PATCH v2] exec: make -mem-path filenames deterministic |
Date: |
Fri, 01 Mar 2013 19:47:48 +0100 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130215 Thunderbird/17.0.3 |
Am 01.03.2013 18:21, schrieb address@hidden:
> From: Peter Feiner <address@hidden>
>
> Adds ramblocks' names to their backing files when using -mem-path. Eases
> introspection and debugging.
>
> Signed-off-by: Peter Feiner <address@hidden>
> ---
>
> On Tue, Jan 8, 2013 at 2:04 PM, Anthony Liguori <address@hidden> wrote:
>>
>> Yes, please submit the oneliner.
>
> Here it is :)
>
> The commit should probably be called "exec: add ramblocks' names to -mem-path
> files" since the paths aren't deterministic.
>
> v1 -> v2: Just add ramblock name to mkstemp template.
>
> Thanks,
> Peter
>
> exec.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/exec.c b/exec.c
> index a41bcb8..16a5452 100644
> --- a/exec.c
> +++ b/exec.c
> @@ -865,7 +865,8 @@ static void *file_ram_alloc(RAMBlock *block,
> return NULL;
> }
>
> - filename = g_strdup_printf("%s/qemu_back_mem.XXXXXX", path);
> + filename = g_strdup_printf("%s/qemu_back_mem.%s.XXXXXX", path,
> + block->mr->name);
Is it safe to use a MemoryRegion name as part of mkstemp()? "/../" seems
rather unlikely but a "/" less so.
Also note that v2 is expected to be posted as a top-level patch since
the patches tool does not cope well with "hidden" reposts.
Andreas
>
> fd = mkstemp(filename);
> if (fd < 0) {
>
--
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg