mirror of
https://github.com/wolfSSL/wolfssl.git
synced 2025-07-31 11:17:29 +02:00
Merge pull request #292 from dgarske/WolfRootFindFix
Fixed bug with "ChangeToWolfRoot" that was incorrectly seeking previo…
This commit is contained in:
16
wolfssl/test.h
Normal file → Executable file
16
wolfssl/test.h
Normal file → Executable file
@ -1212,11 +1212,8 @@ static INLINE int OpenNitroxDevice(int dma_mode,int dev_id)
|
||||
static INLINE int ChangeToWolfRoot(void)
|
||||
{
|
||||
#if !defined(NO_FILESYSTEM)
|
||||
int depth;
|
||||
int depth, res;
|
||||
XFILE file;
|
||||
char path[MAX_PATH];
|
||||
XMEMSET(path, 0, MAX_PATH);
|
||||
|
||||
for(depth = 0; depth <= MAX_WOLF_ROOT_DEPTH; depth++) {
|
||||
file = XFOPEN(ntruKey, "rb");
|
||||
if (file != XBADFILE) {
|
||||
@ -1224,15 +1221,14 @@ static INLINE int OpenNitroxDevice(int dma_mode,int dev_id)
|
||||
return depth;
|
||||
}
|
||||
#ifdef USE_WINDOWS_API
|
||||
XSTRNCAT(path, "..\\", MAX_PATH - XSTRLEN(path));
|
||||
SetCurrentDirectoryA(path);
|
||||
res = SetCurrentDirectoryA("..\\");
|
||||
#else
|
||||
XSTRNCAT(path, "../", MAX_PATH - XSTRLEN(path));
|
||||
if (chdir(path) < 0) {
|
||||
printf("chdir to %s failed\n", path);
|
||||
res = chdir("../");
|
||||
#endif
|
||||
if (res < 0) {
|
||||
printf("chdir to ../ failed!\n");
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
err_sys("wolf root not found");
|
||||
|
Reference in New Issue
Block a user