Am 01.03.2013 18:21, schrieb pe...@gridcentric.ca:
> From: Peter Feiner <pe...@gridcentric.ca>
> 
> Adds ramblocks' names to their backing files when using -mem-path.  Eases
> introspection and debugging.
> 
> Signed-off-by: Peter Feiner <pe...@gridcentric.ca>
> ---
> 
> On Tue, Jan 8, 2013 at 2:04 PM, Anthony Liguori <aligu...@us.ibm.com> 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

Reply via email to