eric pouech (@epo) commented about programs/cmd/builtins.c:
status = SetCurrentDirectoryW(string);
if (!status) {
return_code = ERROR_PATH_NOT_FOUND;
} else {
/* Save away the actual new directory, to store as current location */
GetCurrentDirectoryW(ARRAY_SIZE(string), string);
/* Restore old directory if drive letter would change, and
CD x:\directory /D (or pushd c:\directory) not supplied */
if (cwd != NULL) {
SetCurrentDirectoryW(cwd);
}
}
/* Set special =C: type environment variable, for drive letter of
it looks wrong to set the =C: env variable when SetCurrentDirectory fails (yes, it's what the existing code is doing, but it's a good opportunity to fix it)