Re: [PATCH v6 0/2] MR11094: cmd: Add wildcard expansion for type command.
In this recent push I removed the following block from the wildcard present in `thisArg` path. My reasoning for this is simply that if the path doesn't exist, `FindFirstFileW` catches it beforehand, so there is no real need to validate the result of `CreateFileW` . Is there any case where this fails though? Where somehow FindFirstFileW detects a file but maybe it gets deleted somehow before CreateFileW is called? ``` if (hIn == INVALID_HANDLE_VALUE) { DWORD is_dir_error; /* Store GetLastError right after CreateFileW so that it isn't overwritten */ is_dir_error = GetLastError(); return_code = ERROR_INVALID_FUNCTION; WCMD_print_error (); WCMD_output_stderr(WCMD_LoadMessage(WCMD_READFAIL), srcpath); FindClose(hff); /* Invalid directory path; Return immediately */ if(is_dir_error == ERROR_PATH_NOT_FOUND) { return errorlevel = ERROR_INVALID_FUNCTION; } continue; } ``` I also moved the ``` hOut = GetStdHandle(STD_OUTPUT_HANDLE); ``` line to before the start of the while loop as STD_OUTPUT won't change throughout the program's execution. -- https://gitlab.winehq.org/wine/wine/-/merge_requests/11094#note_144872
participants (1)
-
Barath Kannan (@barath_kannan)