On Sun, Nov 02, 2003 at 05:54:56PM +0100, Paul Diaconescu wrote:
> Ok, attaching output. I get a corrupt gif file now instead of a 1 byte
> file. I did a clean install and changed the mime.type file. I don't
> have any output in error.log - recompiling with the patch right now.
Now, that's more interesting. You're getting 164 bytes of the GIF; and the
164th byte is 255, which looks like it's being interpreted as end-of-file.
This is the same problem as before.
It's a Solaris bug if putchar(255) returns -1. However, perhaps the casts of
char -> unsigned char -> int are being optimised out.
Try the attached patch and see if that fixes it.
Regards,
Brian.
--- sqwebmail/folder.c.orig Sun Nov 2 16:02:49 2003
+++ sqwebmail/folder.c Sun Nov 2 17:11:53 2003
@@ -3402,8 +3408,9 @@
static int download_func(const char *p, size_t cnt, void *voidptr)
{
+ const unsigned char *p2 = (const unsigned char*)p;
while (cnt--)
- if (putchar((int)(unsigned char)*p++) == EOF)
+ if (putchar(*p2++) == EOF)
{
cleanup();
fake_exit(0);