Skip to content

Commit

Permalink
console: switch ppm_save to qemu_open
Browse files Browse the repository at this point in the history
... so it works with fdset.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
  • Loading branch information
kraxel authored and Anthony Liguori committed Apr 25, 2013
1 parent 14a9364 commit cdd5b93
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions ui/console.c
Expand Up @@ -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;
Expand Down

0 comments on commit cdd5b93

Please sign in to comment.