Mo Feb 01 2010 11:09:33 EST von dothebart @ Uncensored

 

Mo Feb 01 2010 10:22:40 EST von dothebart @ Uncensored

hm, I've seem to have broken the attachment downloading?



whew. this is strange.

I can trace citserver doing...

CC->download_fp = tmpfile();
if (CC->download_fp == NULL)
return;

rv = fwrite(content, length, 1, CC->download_fp);
fflush(CC->download_fp);
rewind(CC->download_fp);

OpenCmdResult(filename, cbtype);

and... in file_ops cmd_read()

fseek(CC->download_fp, start_pos, 0);
if (fread(buf, 1, bytes, CC->download_fp) == 1) {
will go to

cprintf("%d %s\n", ERROR, strerror(errno));
and print "success"

WTF?



Ok, this is a bug in the fread() bug correction.

fread will return 4096 here, not 1

most probably because of unitsize and units is swapped here in opposite to the other cases:

r8246 | ajc | 2010-01-18 00:12:55 +0100 (Mo, 18. Jan 2010) | 1 Zeile
Geänderte Pfade:
M /trunk/citadel/config.c
M /trunk/citadel/file_ops.c

* Fixed another fread() bug

so, should we revert the file_ops part of r8246?

Reply via email to