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

Balazs Scheidler bazsi at balabit.hu
Thu Oct 26 12:41:50 CEST 2006


On Wed, 2006-10-25 at 11:30 -0700, Mr. Brian Opitz wrote:
> System is OS X 10.4.8, Xcode 2.4, PPC G4(2.7), configure
> --enable-debug --enable-dynamic-linking
> 
> I am seeing the following warnings during compiling 2.0RC4:

I'm still using gcc 3.4, it is probably gcc 4 that gives these warnings.
See my interpretation of these warnings below:

> 
> 
> logmsg.c: In function 'log_msg_parse':
> logmsg.c:149: warning: pointer targets in assignment differ in
> signedness
> logmsg.c:212: warning: pointer targets in passing argument 2 of
> 'g_string_assign_len' differ in signedness
> logmsg.c:214: warning: pointer targets in assignment differ in
> signedness
> logmsg.c:232: warning: pointer targets in passing argument 1 of
> 'strlen' differ in signedness
> logmsg.c:271: warning: pointer targets in passing argument 2 of
> 'g_string_assign_len' differ in signedness
> logmsg.c:309: warning: pointer targets in assignment differ in
> signedness
> logmsg.c:313: warning: pointer targets in assignment differ in
> signedness
> logmsg.c:344: warning: pointer targets in assignment differ in
> signedness
> logmsg.c:378: warning: pointer targets in assignment differ in
> signedness
> logmsg.c:389: warning: pointer targets in assignment differ in
> signedness
> logmsg.c:401: warning: pointer targets in assignment differ in
> signedness
> logmsg.c:413: warning: pointer targets in assignment differ in
> signedness
> logmsg.c:435: warning: pointer targets in assignment differ in
> signedness
> logmsg.c:440: warning: pointer targets in assignment differ in
> signedness
> logmsg.c:445: warning: pointer targets in passing argument 2 of
> 'g_string_assign_len' differ in signedness

These seem to be harmless, gchar vs. guchar is passed for various
functions. 

> 
> and:
> 
> 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.

> 
> and:
> 
> afuser.c: In function 'afuser_dd_queue':
> afuser.c:57: warning: implicit declaration of function 'getutent'
> afuser.c:57: warning: assignment makes pointer from integer without a
> cast

hmm... afuser.c has #include <utmp.h> which should define getutent, this
seems to be a MacOS specific problem. Can you check which header defines
getutent() and whether it is defined at all?

> 
> and finally:
> 
> gsockaddr.c: In function 'g_accept':
> gsockaddr.c:116: warning: pointer targets in passing argument 3 of
> 'accept' differ in signedness

this is probably a socklen_t vs int mismatch. Should not matter if 32
bit platform is used. also fixed.

> 
> Can these safely be ignored or is there something that needs to be
> changed to make them go away?

Here's a patch, that fixes gsockaddr.c and affile.c, can you confirm
that?

--- orig/src/affile.c
+++ mod/src/affile.c
@@ -453,13 +453,13 @@ affile_dd_init(LogPipe *s, GlobalConfig
     self->file_uid = cfg->file_uid;
   if (self->file_gid == -1)
     self->file_gid = cfg->file_gid;
-  if (self->file_perm == -1)
+  if (self->file_perm == (mode_t) -1)
     self->file_perm = cfg->file_perm;
   if (self->dir_uid == -1)
     self->dir_uid = cfg->dir_uid;
   if (self->dir_gid == -1)
     self->dir_gid = cfg->dir_gid;
-  if (self->dir_perm == -1)
+  if (self->dir_perm == (mode_t) -1)
     self->dir_perm = cfg->dir_perm;
   if (self->time_reap == -1)
     self->time_reap = cfg->time_reap;
@@ -595,9 +595,9 @@ affile_dd_new(gchar *filename, guint32 f
   self->filename_template = log_template_new(NULL, filename);
   self->flags = flags;
   self->file_uid = self->file_gid = -1;
-  self->file_perm = -1;
+  self->file_perm = (mode_t) -1;
   self->dir_uid = self->dir_gid = -1;
-  self->dir_perm = -1;
+  self->dir_perm = (mode_t) -1;
   log_writer_options_defaults(&self->writer_options);
   if (strchr(filename, '$') == NULL)
     {


--- orig/src/gsockaddr.c
+++ mod/src/gsockaddr.c
@@ -109,7 +109,7 @@ GIOStatus
 g_accept(int fd, int *newfd, GSockAddr **addr)
 {
   char sabuf[1024];
-  int salen = sizeof(sabuf);
+  socklen_t salen = sizeof(sabuf);

   do
     {





-- 
Bazsi



More information about the syslog-ng mailing list