From patchwork Sun Mar 24 17:27:16 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rabin Vincent X-Patchwork-Id: 230468 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id C28BD2C00B5 for ; Mon, 25 Mar 2013 04:27:56 +1100 (EST) Received: from localhost ([::1]:59284 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UJoi2-0004a3-RL for incoming@patchwork.ozlabs.org; Sun, 24 Mar 2013 13:27:54 -0400 Received: from eggs.gnu.org ([208.118.235.92]:53723) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UJohc-0004XT-DU for qemu-devel@nongnu.org; Sun, 24 Mar 2013 13:27:29 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UJoha-00012P-VW for qemu-devel@nongnu.org; Sun, 24 Mar 2013 13:27:28 -0400 Received: from mail-la0-x22a.google.com ([2a00:1450:4010:c03::22a]:46120) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UJoha-00012C-Nu for qemu-devel@nongnu.org; Sun, 24 Mar 2013 13:27:26 -0400 Received: by mail-la0-f42.google.com with SMTP id fe20so10078412lab.1 for ; Sun, 24 Mar 2013 10:27:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=x-received:sender:from:to:cc:subject:date:message-id:x-mailer :in-reply-to:references; bh=5vprArE3PlOd1VnqX8TyzCP4OcDgpl/TC19xS3+WaCU=; b=oy7r5TgrnNHsyeAkw67yllft+iGwOVaNT/7u3y6d//PvOYaR2aO91MX9G6HS5sBiYG NN6zag7NcauEALZEWW3/yPXgfEbEne9+0nWzF5mQ9wPLUwIy4zPDmN53VHUrvR5RqR87 WaWjMgt8qE+G6pQnGl2QOQjD5EVIggWp65oEd/lwvt08MbHDMpokAlOpVaD5yBcf59UZ 8FTaa/6S78Cxv9cTS6cdsuTbRMlOfluyi98f710jH+mD8j3Xh190unLSDo74V5lHloi1 7NdFNsUzXBBlljcev7IS2cRQvfUEOmVzr/MAJo3ts+rEzLls7Oi0msWQce0yq/+mVIqN rt7w== X-Received: by 10.152.133.67 with SMTP id pa3mr4432930lab.44.1364146045635; Sun, 24 Mar 2013 10:27:25 -0700 (PDT) Received: from localhost.localdomain (c83-254-193-108.bredband.comhem.se. [83.254.193.108]) by mx.google.com with ESMTPS id jh4sm3877036lab.7.2013.03.24.10.27.23 (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Sun, 24 Mar 2013 10:27:24 -0700 (PDT) From: Rabin Vincent To: qemu-devel@nongnu.org Date: Sun, 24 Mar 2013 18:27:16 +0100 Message-Id: <1364146041-27041-2-git-send-email-rabin@rab.in> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1364146041-27041-1-git-send-email-rabin@rab.in> References: <1364146041-27041-1-git-send-email-rabin@rab.in> X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2a00:1450:4010:c03::22a Cc: Rabin Vincent Subject: [Qemu-devel] [PATCHv2 1/6] dump: create writable files X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org 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 --- 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;