From: Gerd Hoffmann <kraxel@redhat.com>
To: qemu-devel@nongnu.org
Cc: Anthony Liguori <aliguori@us.ibm.com>, Gerd Hoffmann <kraxel@redhat.com>
Subject: [Qemu-devel] [PATCH 4/6] console: switch ppm_save to qemu_open
Date: Thu, 25 Apr 2013 09:56:13 +0200 [thread overview]
Message-ID: <1366876575-23958-5-git-send-email-kraxel@redhat.com> (raw)
In-Reply-To: <1366876575-23958-1-git-send-email-kraxel@redhat.com>
... so it works with fdset.
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
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;
--
1.7.9.7
next prev parent reply other threads:[~2013-04-25 7:56 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-04-25 7:56 [Qemu-devel] [PULL v2 0/6] console: qom-ify consoles Gerd Hoffmann
2013-04-25 7:56 ` [Qemu-devel] [PATCH 1/6] console: qom-ify QemuConsole Gerd Hoffmann
2013-04-25 7:56 ` [Qemu-devel] [PATCH 2/6] console: add device link to QemuConsoles Gerd Hoffmann
2013-04-25 7:56 ` [Qemu-devel] [PATCH 3/6] console: add qemu_console_lookup_by_device Gerd Hoffmann
2013-04-25 7:56 ` Gerd Hoffmann [this message]
2013-04-25 7:56 ` [Qemu-devel] [PATCH 5/6] console: zap ds arg from register_displaychangelistener Gerd Hoffmann
2013-04-25 7:56 ` [Qemu-devel] [PATCH 6/6] console: add dummy surface for guests without graphic card Gerd Hoffmann
2013-04-25 20:55 ` [Qemu-devel] [PULL v2 0/6] console: qom-ify consoles Anthony Liguori
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1366876575-23958-5-git-send-email-kraxel@redhat.com \
--to=kraxel@redhat.com \
--cc=aliguori@us.ibm.com \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).