The handle returned by FindFirstFileW() needs to be closed by
FindClose(), not by CloseHandle().
This is a very old bug, which presumably wasn't noticed before because
ordinarily it just leaked the handle. However, this bug caused a SEH
exception when wimlib was run under a debugger.
pglob->gl_pathv[pglob->gl_pathc++] = path;
} while (FindNextFileW(hFind, &dat));
err = GetLastError();
pglob->gl_pathv[pglob->gl_pathc++] = path;
} while (FindNextFileW(hFind, &dat));
err = GetLastError();
if (err != ERROR_NO_MORE_FILES) {
set_errno_from_win32_error(err);
ret = GLOB_ABORTED;
if (err != ERROR_NO_MORE_FILES) {
set_errno_from_win32_error(err);
ret = GLOB_ABORTED;
errno = ENOMEM;
ret = GLOB_NOSPACE;
fail_globfree:
errno = ENOMEM;
ret = GLOB_NOSPACE;
fail_globfree: