[syslog-ng] 2.0RC4 make warning on OS X 10.4.8 PPC G4

Valdis.Kletnieks at vt.edu Valdis.Kletnieks at vt.edu
Thu Oct 26 19:38:56 CEST 2006


On Thu, 26 Oct 2006 12:41:50 +0200, Balazs Scheidler said:
>
> > affile.c: In function 'affile_dd_init':
> > affile.c:456: warning: comparison is always false due to limited range
> > of data type
> > affile.c:462: warning: comparison is always false due to limited range
> > of data type
> 
> This might be a problem if the compiler optimizes the if statement out.
> I have added casts to fix this issue.

You need to be careful here... sometimes this sort of thing is a "fix"
rather than a real fix...

> -  if (self->file_perm == -1)
> +  if (self->file_perm == (mode_t) -1)
>      self->file_perm = cfg->file_perm;

The reason the compiler complains is that if proper type safety has been
followed *elsewhere*, it can't have been equal to -1.  In other words, if
this is the only place you had to add the cast, it's *still* buggy.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 226 bytes
Desc: not available
Url : http://lists.balabit.hu/pipermail/syslog-ng/attachments/20061026/036fe49d/attachment.pgp


More information about the syslog-ng mailing list