projects
/
citadel.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
when we fail to preserve the temporary file for mime download preparation print out...
[citadel.git]
/
citadel
/
msgbase.c
diff --git
a/citadel/msgbase.c
b/citadel/msgbase.c
index 2609d1d1da7b08bc7a0ed816a48d531a3961a1bb..824b51bd337974b232da9bd2644ccaed22db1085 100644
(file)
--- a/
citadel/msgbase.c
+++ b/
citadel/msgbase.c
@@
-1084,26
+1084,37
@@
void mime_download(char *name, char *filename, char *partnum, char *disp,
char *encoding, char *cbid, void *cbuserdata)
{
int rv = 0;
char *encoding, char *cbid, void *cbuserdata)
{
int rv = 0;
+ CitContext *CCC = MyContext();
/* Silently go away if there's already a download open. */
/* Silently go away if there's already a download open. */
- if (CC->download_fp != NULL)
+ if (CC
C
->download_fp != NULL)
return;
if (
return;
if (
- (!IsEmptyStr(partnum) && (!strcasecmp(CC->download_desired_section, partnum)))
- || (!IsEmptyStr(cbid) && (!strcasecmp(CC->download_desired_section, cbid)))
+ (!IsEmptyStr(partnum) && (!strcasecmp(CC
C
->download_desired_section, partnum)))
+ || (!IsEmptyStr(cbid) && (!strcasecmp(CC
C
->download_desired_section, cbid)))
) {
) {
- CC->download_fp = tmpfile();
- if (CC->download_fp == NULL)
+ CCC->download_fp = tmpfile();
+ if (CCC->download_fp == NULL) {
+ syslog(LOG_EMERG, "mime_download(): Couldn't write: %s\n",
+ strerror(errno));
+ cprintf("%d cannot open temporary file: %s\n",
+ ERROR + INTERNAL_ERROR, strerror(errno));
return;
return;
+ }
rv = fwrite(content, length, 1, CC->download_fp);
rv = fwrite(content, length, 1, CC->download_fp);
- if (rv
== -1
) {
+ if (rv
<= 0
) {
syslog(LOG_EMERG, "mime_download(): Couldn't write: %s\n",
strerror(errno));
syslog(LOG_EMERG, "mime_download(): Couldn't write: %s\n",
strerror(errno));
+ cprintf("%d unable to write tempfile.\n",
+ ERROR + TOO_BIG);
+ fclose(CCC->download_fp);
+ CCC->download_fp = NULL;
+ return;
}
}
- fflush(CC->download_fp);
- rewind(CC->download_fp);
+ fflush(CC
C
->download_fp);
+ rewind(CC
C
->download_fp);
OpenCmdResult(filename, cbtype);
}
OpenCmdResult(filename, cbtype);
}