Merged revisions 161147 via svnmerge from

https://origsvn.digium.com/svn/asterisk/trunk

........
  r161147 | seanbright | 2008-12-04 21:47:54 -0500 (Thu, 04 Dec 2008) | 3 lines
  
  Check the return value of fread/fwrite so the compiler doesn't complain.  Only a
  problem when IMAP_STORAGE is enabled.
........


git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.6.0@161148 65c4cc65-6c06-0410-ace0-fbb531ad65f3
1.6.0
Sean Bright 17 years ago
parent b1c3c64122
commit 2b4bfa3c77

@ -1419,7 +1419,12 @@ static int imap_store_file(char *dir, char *mailboxuser, char *mailboxcontext, i
*(vmu->email) = '\0'; *(vmu->email) = '\0';
return -1; return -1;
} }
fread(buf, len, 1, p); if (fread(buf, len, 1, p) < len) {
if (ferror(p)) {
ast_log(LOG_ERROR, 'Short read while reading in mail file.\n");
return -1;
}
}
((char *)buf)[len] = '\0'; ((char *)buf)[len] = '\0';
INIT(&str, mail_string, buf, len); INIT(&str, mail_string, buf, len);
init_mailstream(vms, NEW_FOLDER); init_mailstream(vms, NEW_FOLDER);
@ -1840,7 +1845,11 @@ static void write_file(char *filename, char *buffer, unsigned long len)
FILE *output; FILE *output;
output = fopen (filename, "w"); output = fopen (filename, "w");
fwrite (buffer, len, 1, output); if (fwrite(buffer, len, 1, output) < len) {
if (ferror(output)) {
ast_log(LOG_ERROR, "Short write while writing e-mail body.\n");
}
}
fclose (output); fclose (output);
} }

Loading…
Cancel
Save