Commit 7fb2a862f40a9615f8ae5bc3f8c0c2d33ee8db91

Authored by malc
1 parent 0e674589

Fix error reporting under Win32 (CreateFile does not set errno)


git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@4698 c046a42c-6fe2-441c-8c8c-71466251a162
Showing 1 changed file with 6 additions and 1 deletions
... ... @@ -166,14 +166,19 @@ int kqemu_init(CPUState *env)
166 166 FILE_SHARE_READ | FILE_SHARE_WRITE,
167 167 NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL,
168 168 NULL);
  169 + if (kqemu_fd == KQEMU_INVALID_FD) {
  170 + fprintf(stderr, "Could not open '%s' - QEMU acceleration layer not activated: %lu\n",
  171 + KQEMU_DEVICE, GetLastError());
  172 + return -1;
  173 + }
169 174 #else
170 175 kqemu_fd = open(KQEMU_DEVICE, O_RDWR);
171   -#endif
172 176 if (kqemu_fd == KQEMU_INVALID_FD) {
173 177 fprintf(stderr, "Could not open '%s' - QEMU acceleration layer not activated: %s\n",
174 178 KQEMU_DEVICE, strerror(errno));
175 179 return -1;
176 180 }
  181 +#endif
177 182 version = 0;
178 183 #ifdef _WIN32
179 184 DeviceIoControl(kqemu_fd, KQEMU_GET_VERSION, NULL, 0,
... ...