diff mbox

[1/4] dump: create writable files

Message ID 1340213303-596-1-git-send-email-rabin@rab.in
State New
Headers show

Commit Message

Rabin Vincent June 20, 2012, 5:28 p.m. UTC
Make dump-guest-memory not create read-only files, so that it can
overwrite a file created by a previous invocation without having it to
be removed externally.

Signed-off-by: Rabin Vincent <rabin@rab.in>
---
 dump.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Comments

Luiz Capitulino June 26, 2012, 8:27 p.m. UTC | #1
On Wed, 20 Jun 2012 22:58:20 +0530
Rabin Vincent <rabin@rab.in> wrote:

> Make dump-guest-memory not create read-only files, so that it can
> overwrite a file created by a previous invocation without having it to
> be removed externally.

I think we need a force parameter to do this, the command shouldn't overwrite
files by default.

Wen, can you review this series please?

> 
> Signed-off-by: Rabin Vincent <rabin@rab.in>
> ---
>  dump.c |    3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/dump.c b/dump.c
> index 2bf8d8d..5c5cb4d 100644
> --- a/dump.c
> +++ b/dump.c
> @@ -845,7 +845,8 @@ void qmp_dump_guest_memory(bool paging, const char *file, bool has_begin,
>  #endif
>  
>      if  (strstart(file, "file:", &p)) {
> -        fd = qemu_open(p, O_WRONLY | O_CREAT | O_TRUNC | O_BINARY, S_IRUSR);
> +        fd = qemu_open(p, O_WRONLY | O_CREAT | O_TRUNC | O_BINARY,
> +                       S_IRUSR | S_IWUSR);
>          if (fd < 0) {
>              error_set(errp, QERR_OPEN_FILE_FAILED, p);
>              return;
Wen Congyang June 27, 2012, 9:24 a.m. UTC | #2
At 06/27/2012 04:27 AM, Luiz Capitulino Wrote:
> On Wed, 20 Jun 2012 22:58:20 +0530
> Rabin Vincent <rabin@rab.in> wrote:
> 
>> Make dump-guest-memory not create read-only files, so that it can
>> overwrite a file created by a previous invocation without having it to
>> be removed externally.
> 
> I think we need a force parameter to do this, the command shouldn't overwrite
> files by default.
> 
> Wen, can you review this series please?

OK, I will review it after some days.

Thanks
Wen Congyang

> 
>>
>> Signed-off-by: Rabin Vincent <rabin@rab.in>
>> ---
>>  dump.c |    3 ++-
>>  1 file changed, 2 insertions(+), 1 deletion(-)
>>
>> diff --git a/dump.c b/dump.c
>> index 2bf8d8d..5c5cb4d 100644
>> --- a/dump.c
>> +++ b/dump.c
>> @@ -845,7 +845,8 @@ void qmp_dump_guest_memory(bool paging, const char *file, bool has_begin,
>>  #endif
>>  
>>      if  (strstart(file, "file:", &p)) {
>> -        fd = qemu_open(p, O_WRONLY | O_CREAT | O_TRUNC | O_BINARY, S_IRUSR);
>> +        fd = qemu_open(p, O_WRONLY | O_CREAT | O_TRUNC | O_BINARY,
>> +                       S_IRUSR | S_IWUSR);
>>          if (fd < 0) {
>>              error_set(errp, QERR_OPEN_FILE_FAILED, p);
>>              return;
> 
>
diff mbox

Patch

diff --git a/dump.c b/dump.c
index 2bf8d8d..5c5cb4d 100644
--- a/dump.c
+++ b/dump.c
@@ -845,7 +845,8 @@  void qmp_dump_guest_memory(bool paging, const char *file, bool has_begin,
 #endif
 
     if  (strstart(file, "file:", &p)) {
-        fd = qemu_open(p, O_WRONLY | O_CREAT | O_TRUNC | O_BINARY, S_IRUSR);
+        fd = qemu_open(p, O_WRONLY | O_CREAT | O_TRUNC | O_BINARY,
+                       S_IRUSR | S_IWUSR);
         if (fd < 0) {
             error_set(errp, QERR_OPEN_FILE_FAILED, p);
             return;