diff options
author | Gerd Hoffmann <kraxel@redhat.com> | 2013-04-23 13:26:59 +0200 |
---|---|---|
committer | Anthony Liguori <aliguori@us.ibm.com> | 2013-04-25 14:45:46 -0500 |
commit | cdd5b9375744130e2f49548a3cac7be176a931ca (patch) | |
tree | b088995ccb707dc6db881900b6e8fdf231f4e04d | |
parent | 14a936490bf90df32ab83d13563efe4b4c768c3c (diff) | |
download | qemu-cdd5b9375744130e2f49548a3cac7be176a931ca.tar.gz qemu-cdd5b9375744130e2f49548a3cac7be176a931ca.tar.bz2 qemu-cdd5b9375744130e2f49548a3cac7be176a931ca.zip |
console: switch ppm_save to qemu_open
... so it works with fdset.
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
-rw-r--r-- | ui/console.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/ui/console.c b/ui/console.c index e3ab9853ec..3835316600 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; |