Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 10 additions & 13 deletions apps/wolfsshd/test/test_configuration.c
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ static void CleanupWildcardTest(void)
WSNPRINTF(filepath, sizeof filepath, "%.*s%.*s",
(int)prefixLen, "./sshd_config.d/",
(int)maxNameLen, d->d_name);
WREMOVE(0, filepath);
(void)WREMOVE(0, filepath);
}
}
WCLOSEDIR(NULL, &dir);
Expand Down Expand Up @@ -110,8 +110,7 @@ static int SetupWildcardTest(void)
"./sshd_config.d/");
}

WFOPEN(NULL, &f, filepath, "w");
if (f) {
if (WFOPEN(NULL, &f, filepath, "w") == 0 && f != NULL) {
word32 sz, wr;
char contents[20];
WSNPRINTF(contents, sizeof contents, "LoginGraceTime %02u",
Expand Down Expand Up @@ -1100,31 +1099,29 @@ static int test_IncludeRecursionBound(void)
const char* normalContents = "Port 22\n";
word32 sz, wr;

WFOPEN(NULL, &f, loopPath, "w");
if (f == NULL) {
if (WFOPEN(NULL, &f, loopPath, "w") != 0 || f == NULL) {
Log(" Could not create %s.\n", loopPath);
return WS_FATAL_ERROR;
}
sz = (word32)WSTRLEN(loopContents);
wr = (word32)WFWRITE(NULL, loopContents, sizeof(char), sz, f);
WFCLOSE(NULL, f);
if (sz != wr) {
WREMOVE(0, loopPath);
(void)WREMOVE(0, loopPath);
return WS_FATAL_ERROR;
}

WFOPEN(NULL, &f, normalPath, "w");
if (f == NULL) {
WREMOVE(0, loopPath);
if (WFOPEN(NULL, &f, normalPath, "w") != 0 || f == NULL) {
(void)WREMOVE(0, loopPath);
Log(" Could not create %s.\n", normalPath);
return WS_FATAL_ERROR;
}
sz = (word32)WSTRLEN(normalContents);
wr = (word32)WFWRITE(NULL, normalContents, sizeof(char), sz, f);
WFCLOSE(NULL, f);
if (sz != wr) {
WREMOVE(0, loopPath);
WREMOVE(0, normalPath);
(void)WREMOVE(0, loopPath);
(void)WREMOVE(0, normalPath);
return WS_FATAL_ERROR;
}

Expand Down Expand Up @@ -1156,8 +1153,8 @@ static int test_IncludeRecursionBound(void)
}

wolfSSHD_ConfigFree(conf);
WREMOVE(0, loopPath);
WREMOVE(0, normalPath);
(void)WREMOVE(0, loopPath);
(void)WREMOVE(0, normalPath);
return ret;
}

Expand Down
Loading