Skip to content
Snippets Groups Projects
Commit 4c235193 authored by Philippe Mathieu-Daudé's avatar Philippe Mathieu-Daudé Committed by Markus Armbruster
Browse files

chardev: Improve error report by calling error_setg_win32()


Use error_setg_win32() which adds a hint similar to strerror(errno)).

Reviewed-by: default avatarDaniel P. Berrangé <berrange@redhat.com>
Reviewed-by: default avatarMarc-André Lureau <marcandre.lureau@redhat.com>
Signed-off-by: default avatarPhilippe Mathieu-Daudé <philmd@redhat.com>
Message-Id: <20200228100726.8414-2-philmd@redhat.com>
Signed-off-by: default avatarMarkus Armbruster <armbru@redhat.com>
parent 67f17e23
No related branches found
No related tags found
No related merge requests found
......@@ -70,7 +70,7 @@ static int win_chr_pipe_init(Chardev *chr, const char *filename,
MAXCONNECT, NSENDBUF, NRECVBUF, NTIMEOUT, NULL);
g_free(openname);
if (s->file == INVALID_HANDLE_VALUE) {
error_setg(errp, "Failed CreateNamedPipe (%lu)", GetLastError());
error_setg_win32(errp, GetLastError(), "Failed CreateNamedPipe");
s->file = NULL;
goto fail;
}
......
......@@ -96,7 +96,7 @@ int win_chr_serial_init(Chardev *chr, const char *filename, Error **errp)
s->file = CreateFile(filename, GENERIC_READ | GENERIC_WRITE, 0, NULL,
OPEN_EXISTING, FILE_FLAG_OVERLAPPED, 0);
if (s->file == INVALID_HANDLE_VALUE) {
error_setg(errp, "Failed CreateFile (%lu)", GetLastError());
error_setg_win32(errp, GetLastError(), "Failed CreateFile");
s->file = NULL;
goto fail;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment