[Dovecot] comparing pointer to integer?

Bérczi Gábor (Gabucino) gabor at berczi.be
Thu Aug 30 15:49:41 EEST 2007


For example in src/lib/file-cache.c:

if (cache->mmap_base == MAP_FAILED) {

Should be fixed, probably like this:

if ((int)cache->mmap_base == MAP_FAILED) {

There are a lot of occurences for these in the source. GCC only warns  
because of this, but DEC C is known to consider this an error:

Error: file-cache.c, line 79: In this statement, "new_base" and  
"(-1)" may not be compared for equality or inequality.
if (new_base == MAP_FAILED) {

And indeed, unsigned integers and -1 are rarely equal.

-- 
Gabucino



More information about the dovecot mailing list