From patchwork Wed Apr 24 09:33:21 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gerd Hoffmann X-Patchwork-Id: 239097 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 3E3292C010B for ; Wed, 24 Apr 2013 19:35:16 +1000 (EST) Received: from localhost ([::1]:59926 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UUw6c-0000bO-Fi for incoming@patchwork.ozlabs.org; Wed, 24 Apr 2013 05:35:14 -0400 Received: from eggs.gnu.org ([208.118.235.92]:56074) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UUw6A-0000TJ-3C for qemu-devel@nongnu.org; Wed, 24 Apr 2013 05:34:50 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UUw65-000108-EF for qemu-devel@nongnu.org; Wed, 24 Apr 2013 05:34:45 -0400 Received: from mx1.redhat.com ([209.132.183.28]:31400) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UUw4r-0000Mp-6F for qemu-devel@nongnu.org; Wed, 24 Apr 2013 05:33:25 -0400 Received: from int-mx02.intmail.prod.int.phx2.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id r3O9XOOX005236 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Wed, 24 Apr 2013 05:33:24 -0400 Received: from rincewind.home.kraxel.org (ovpn-116-30.ams2.redhat.com [10.36.116.30]) by int-mx02.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id r3O9XNYh032622; Wed, 24 Apr 2013 05:33:23 -0400 Received: by rincewind.home.kraxel.org (Postfix, from userid 500) id DEC7345B60; Wed, 24 Apr 2013 11:33:22 +0200 (CEST) From: Gerd Hoffmann To: qemu-devel@nongnu.org Date: Wed, 24 Apr 2013 11:33:21 +0200 Message-Id: <1366796002-30135-5-git-send-email-kraxel@redhat.com> In-Reply-To: <1366796002-30135-1-git-send-email-kraxel@redhat.com> References: <1366796002-30135-1-git-send-email-kraxel@redhat.com> X-Scanned-By: MIMEDefang 2.67 on 10.5.11.12 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 209.132.183.28 Cc: Anthony Liguori , Gerd Hoffmann Subject: [Qemu-devel] [PATCH 4/5] console: switch ppm_save to qemu_open 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 ... so it works with fdset. Signed-off-by: Gerd Hoffmann --- ui/console.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/ui/console.c b/ui/console.c index e3ab985..3835316 100644 --- a/ui/console.c +++ b/ui/console.c @@ -269,18 +269,20 @@ static void ppm_save(const char *filename, struct DisplaySurface *ds, { int width = pixman_image_get_width(ds->image); int height = pixman_image_get_height(ds->image); + int fd; FILE *f; int y; int ret; pixman_image_t *linebuf; trace_ppm_save(filename, ds); - f = fopen(filename, "wb"); - if (!f) { + fd = qemu_open(filename, O_WRONLY | O_CREAT | O_TRUNC | O_BINARY, 0666); + if (fd == -1) { error_setg(errp, "failed to open file '%s': %s", filename, strerror(errno)); return; } + f = fdopen(fd, "wb"); ret = fprintf(f, "P6\n%d %d\n%d\n", width, height, 255); if (ret < 0) { linebuf = NULL;