bug-mailutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[bug-mailutils] 64-bit bug in stream.c


From: Joseph Caputo
Subject: [bug-mailutils] 64-bit bug in stream.c
Date: Fri, 10 Jun 2005 11:38:05 -0400
User-agent: KMail/1.7.2

Hi,

Just trying to get the 0.6 release working on a 64-bit Solaris 8 box, 
and I encountered a bug.  It seems that in mailbox/include/stream0.h, 
we have the declaration:

/* Read buffer */
struct rbuffer
{
  char *base;
  char *ptr;
  int count;
  size_t bufsiz;
  off_t offset;
};

However, in stream.c, we have the function "refill()", which calls a 
_read() function with the signature:

int _read( stream_t, char *, size_t, off_t, size_t * )

and it's passing (size_t *)&(rbuffer.count) as the final argument.

Of course, on a 64-bit system, sizeof(size_t) != sizeof(int); more 
specifically, size_t == 64 bits, int == 32 bits.  This is causing the 
'count' member to not be set properly, and the mailbox scan functions 
incorrectly determines that the mailbox has no messages.

Changing the definition of the "count" member from int -> size_t fixes 
the problem for me in 0.6.

I also checked the 0.6.90 release, and the offending code is still thre, 
but I have other compile issues with 0.6.90.  Might be a good idea to 
look for other similar 64-bit related bugs...


-- 
Joseph A. Caputo |Senior Software Engineer
QED Information Systems, Inc.
10201 Sagemore | Marlton, NJ 08053
856/797.1200 - Tel. | 856/797.9719 - Fax
address@hidden | http://www.qedinfo.com/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]