diff mbox

[PATCHv2,1/6] dump: create writable files

Message ID 1364146041-27041-2-git-send-email-rabin@rab.in
State New
Headers show

Commit Message

Rabin Vincent March 24, 2013, 5:27 p.m. UTC
The files dump-guest-memory are created as read-only even for the owner.
This non-standard behaviour makes it annoying to deal with the dump
files (eg. rm -f is needed to delete them or saving a new dump by
overwriting the previous one is not possible).  Change the code to
generate files with write permissions set.  If someone requires
read-only files to be created, they can achieve it by setting umask.

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

Comments

Paolo Bonzini April 4, 2013, 9:42 a.m. UTC | #1
Il 24/03/2013 18:27, Rabin Vincent ha scritto:
> The files dump-guest-memory are created as read-only even for the owner.
> This non-standard behaviour makes it annoying to deal with the dump
> files (eg. rm -f is needed to delete them or saving a new dump by
> overwriting the previous one is not possible).  Change the code to
> generate files with write permissions set.  If someone requires
> read-only files to be created, they can achieve it by setting umask.
> 
> 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 a25f509..8dd86b4 100644
> --- a/dump.c
> +++ b/dump.c
> @@ -841,7 +841,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;
> 

Rabim, I think you should resend this patch separately.  Cc
qemu-trivial@nongnu.org and qemu-stable@nongnu.org, please.

Paolo
diff mbox

Patch

diff --git a/dump.c b/dump.c
index a25f509..8dd86b4 100644
--- a/dump.c
+++ b/dump.c
@@ -841,7 +841,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;