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:
24
wolfssl/test.h
Normal file → Executable file
24
wolfssl/test.h
Normal file → Executable file
@ -1212,27 +1212,23 @@ static INLINE int OpenNitroxDevice(int dma_mode,int dev_id)
|
|||||||
static INLINE int ChangeToWolfRoot(void)
|
static INLINE int ChangeToWolfRoot(void)
|
||||||
{
|
{
|
||||||
#if !defined(NO_FILESYSTEM)
|
#if !defined(NO_FILESYSTEM)
|
||||||
int depth;
|
int depth, res;
|
||||||
XFILE file;
|
XFILE file;
|
||||||
char path[MAX_PATH];
|
|
||||||
XMEMSET(path, 0, MAX_PATH);
|
|
||||||
|
|
||||||
for(depth = 0; depth <= MAX_WOLF_ROOT_DEPTH; depth++) {
|
for(depth = 0; depth <= MAX_WOLF_ROOT_DEPTH; depth++) {
|
||||||
file = XFOPEN(ntruKey, "rb");
|
file = XFOPEN(ntruKey, "rb");
|
||||||
if (file != XBADFILE) {
|
if (file != XBADFILE) {
|
||||||
XFCLOSE(file);
|
XFCLOSE(file);
|
||||||
return depth;
|
return depth;
|
||||||
}
|
}
|
||||||
#ifdef USE_WINDOWS_API
|
#ifdef USE_WINDOWS_API
|
||||||
XSTRNCAT(path, "..\\", MAX_PATH - XSTRLEN(path));
|
res = SetCurrentDirectoryA("..\\");
|
||||||
SetCurrentDirectoryA(path);
|
#else
|
||||||
#else
|
res = chdir("../");
|
||||||
XSTRNCAT(path, "../", MAX_PATH - XSTRLEN(path));
|
#endif
|
||||||
if (chdir(path) < 0) {
|
if (res < 0) {
|
||||||
printf("chdir to %s failed\n", path);
|
printf("chdir to ../ failed!\n");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
err_sys("wolf root not found");
|
err_sys("wolf root not found");
|
||||||
|
Reference in New Issue
Block a user