Skip to content

Commit f56356a

Browse files
julek-wolfssldgarske
authored andcommitted
test_lms_write_key: check fwrite return
1 parent 43a36a1 commit f56356a

1 file changed

Lines changed: 4 additions & 5 deletions

File tree

tests/api.c

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33615,14 +33615,13 @@ int test_wc_LmsKey_reload_cache(void);
3361533615
static int test_lms_write_key(const byte* priv, word32 privSz, void* context)
3361633616
{
3361733617
FILE* f = fopen((const char*)context, "wb");
33618+
int ret = WC_LMS_RC_SAVED_TO_NV_MEMORY;
3361833619
if (f == NULL)
3361933620
return -1;
33620-
if (fwrite(priv, 1, privSz, f) != privSz) {
33621-
fclose(f);
33622-
return -1;
33623-
}
33621+
if (fwrite(priv, 1, privSz, f) != privSz)
33622+
ret = -1;
3362433623
fclose(f);
33625-
return WC_LMS_RC_SAVED_TO_NV_MEMORY;
33624+
return ret;
3362633625
}
3362733626

3362833627
static int test_lms_read_key(byte* priv, word32 privSz, void* context)

0 commit comments

Comments
 (0)