Skip to content

Commit

Permalink
File error checks added
Browse files Browse the repository at this point in the history
  • Loading branch information
cpiker committed Dec 13, 2023
1 parent ba98458 commit df7229e
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions das2/credentials.c
Original file line number Diff line number Diff line change
Expand Up @@ -385,6 +385,10 @@ int CredMngr_save(DasCredMngr* pThis, const char* sSymKey, const char* sFile)
}

FILE* pOut = fopen(sOut, "wb");
if(pOut == NULL){
daslog_error_v("Couldn't open '%s' for writing", sOut);
return -1;
}

int nRet = 0;
das_credential* pCred = NULL;
Expand Down Expand Up @@ -432,6 +436,10 @@ int CredMngr_load(DasCredMngr* pThis, const char* sSymKey, const char* sFile)
}

FILE* pIn = fopen(sIn, "rb");
if(pIn == NULL){
daslog_error_v("Couldn't open '%s' for reading", sIn);
return -1;
}

// Make an array to the side to hold loaded credentials
das_credential fill;
Expand Down

0 comments on commit df7229e

Please sign in to comment.