aboutsummaryrefslogtreecommitdiff
path: root/chardev/char-win.c
diff options
context:
space:
mode:
authorMarc-André Lureau <marcandre.lureau@redhat.com>2017-01-04 21:34:42 +0100
committerMarc-André Lureau <marcandre.lureau@redhat.com>2017-06-02 11:33:52 +0400
commit541815ff7f54f45a60d058b1c499c4affff094e0 (patch)
treea50d8c62275dca04fc30127199ac7a4b507faa70 /chardev/char-win.c
parentef0f272f38e1e534dd05a5a611aa0eb15dc60cc1 (diff)
downloadqemu-541815ff7f54f45a60d058b1c499c4affff094e0.zip
qemu-541815ff7f54f45a60d058b1c499c4affff094e0.tar.gz
qemu-541815ff7f54f45a60d058b1c499c4affff094e0.tar.bz2
char-win: close file handle except with console
Only the console handle shouldn't be closed, however, the "file" handle should. Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Diffstat (limited to 'chardev/char-win.c')
-rw-r--r--chardev/char-win.c12
1 files changed, 4 insertions, 8 deletions
diff --git a/chardev/char-win.c b/chardev/char-win.c
index a7e3296..ec9a731 100644
--- a/chardev/char-win.c
+++ b/chardev/char-win.c
@@ -192,17 +192,13 @@ static void char_win_finalize(Object *obj)
Chardev *chr = CHARDEV(obj);
WinChardev *s = WIN_CHARDEV(chr);
- if (s->skip_free) {
- return;
- }
-
if (s->hsend) {
CloseHandle(s->hsend);
}
if (s->hrecv) {
CloseHandle(s->hrecv);
}
- if (s->file) {
+ if (!s->keep_open && s->file) {
CloseHandle(s->file);
}
if (s->fpipe) {
@@ -214,12 +210,12 @@ static void char_win_finalize(Object *obj)
qemu_chr_be_event(chr, CHR_EVENT_CLOSED);
}
-void qemu_chr_open_win_file(Chardev *chr, HANDLE fd_out)
+void win_chr_set_file(Chardev *chr, HANDLE file, bool keep_open)
{
WinChardev *s = WIN_CHARDEV(chr);
- s->skip_free = true;
- s->file = fd_out;
+ s->keep_open = keep_open;
+ s->file = file;
}
static void char_win_class_init(ObjectClass *oc, void *data)