msvcrt: Fix mutual exclusion over logical or is always a non-zero constant.

Logical and should have been used instead.
This commit is contained in:
Rob Shearman 2008-09-23 13:32:00 +01:00 committed by Alexandre Julliard
parent 62a1beebbf
commit ed9cd3ede2
2 changed files with 3 additions and 3 deletions

View File

@ -990,7 +990,7 @@ void CDECL _searchenv(const char* file, const char* env, char *buf)
return; return;
} }
memcpy(curPath, penv, end - penv); memcpy(curPath, penv, end - penv);
if (curPath[end - penv] != '/' || curPath[end - penv] != '\\') if (curPath[end - penv] != '/' && curPath[end - penv] != '\\')
{ {
curPath[end - penv] = '\\'; curPath[end - penv] = '\\';
curPath[end - penv + 1] = '\0'; curPath[end - penv + 1] = '\0';
@ -1053,7 +1053,7 @@ void CDECL _wsearchenv(const MSVCRT_wchar_t* file, const MSVCRT_wchar_t* env, MS
return; return;
} }
memcpy(curPath, penv, (end - penv) * sizeof(MSVCRT_wchar_t)); memcpy(curPath, penv, (end - penv) * sizeof(MSVCRT_wchar_t));
if (curPath[end - penv] != '/' || curPath[end - penv] != '\\') if (curPath[end - penv] != '/' && curPath[end - penv] != '\\')
{ {
curPath[end - penv] = '\\'; curPath[end - penv] = '\\';
curPath[end - penv + 1] = '\0'; curPath[end - penv + 1] = '\0';

View File

@ -96,7 +96,7 @@ static void msvcrt_search_executable(const MSVCRT_wchar_t *name, MSVCRT_wchar_t
if (path_len + name_len <= MAX_PATH - 2) if (path_len + name_len <= MAX_PATH - 2)
{ {
memcpy(buffer, env, path_len * sizeof(MSVCRT_wchar_t)); memcpy(buffer, env, path_len * sizeof(MSVCRT_wchar_t));
if (buffer[path_len] != '/' || buffer[path_len] != '\\') if (buffer[path_len] != '/' && buffer[path_len] != '\\')
{ {
buffer[path_len++] = '\\'; buffer[path_len++] = '\\';
buffer[path_len] = '\0'; buffer[path_len] = '\0';