Skip to content

Commit

Permalink
Example program will now close the attachment file when successful.
Browse files Browse the repository at this point in the history
  • Loading branch information
richwalm committed Jan 1, 2015
1 parent 1e38f3e commit bde5df1
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions example.c
Original file line number Diff line number Diff line change
Expand Up @@ -152,9 +152,13 @@ static int ReadAttach(FILE **File, void *Buffer, unsigned int BufferSize)

Result = fread(Buffer, 1, BufferSize, *File);

if (Result != BufferSize && ferror(*File)) {
CloseAttach(File);
return -1;
if (Result != BufferSize) {
if (ferror(*File)) {
CloseAttach(File);
return -1;
}
else if (!Result && feof(*File))
CloseAttach(File);
}

return Result;
Expand Down

0 comments on commit bde5df1

Please sign in to comment.