Compiler warnings

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

 



I just compiled the nntpcache-0.87.4UL release (with gcc -Wall)
and found several problems with syslog calls. Here they are with
suggested fixes:  (lines have been wrapped for easier reading)

sockets.c: In function `attachServer':
sockets.c:46: warning: too few arguments for format

syslog(LOG_WARNING, "%s:%d Couldn't connect to %s %d as : %m",
    cfg->server, cfg->port, cfg->us);

should add '__FILE__, __LINE__,' as the first two parameters, and
the %m should be %s, or %s should be added before %m since %m prints
strerror.

 = = = 

nntpcache.c: In function `load_config':
nntpcache.c:164: warning: int format, pointer arg (arg 5)
nntpcache.c:164: warning: too few arguments for format

syslog(LOG_ERR, "%s:%d invalid active file timeout line %d: %s",
    __FILE__, __LINE__, buf);

Add n before buf.

 = = = 

list.c: In function `getListServer':
list.c:69: warning: too many arguments for format

syslog(LOG_DEBUG, "Spooling 'list %s' -> memory", list, oname);

Delete oname? or add %s to print filename?

 = = = 

group.c: In function `CMDgroup':
group.c:83: warning: too few arguments for format

syslog(LOG_DEBUG, "%s:%d couldn't open %s for write : %s",
   __FILE__, __LINE__, attempted_group);

Probably needs %m instead of last %s to print strerror.

 = = = 

history.c: In function `hisGetDbz':
history.c:94: warning: int format, long int arg (arg 5)
history.c: In function `hisAddDbz':
history.c:164: warning: int format, long int arg (arg 6)

syslog(LOG_ERR, "%s:%d couldn't lseek to %d in file '%s' : %m",
   __FILE__, __LINE__, offset, DBZ_HISTORY);
syslog(LOG_ERR, "%s:%d couldn't seek '%s' to %d : %m",
    __FILE__, __LINE__, DBZ_HISTORY, offset);

second %d should be %ld in both lines.

 = = = 

post.c: In function `post':
post.c:99: warning: too few arguments for format

99>syslog(LOG_ERR, "%s:%d couldn't post article to %s : %m",
  >post_cfg->server);

Needs __FILE__, __LINE__ as first parameters.

 = = = 

frank

-- 
Frank Smith  --  System Administrator         E-mail: fsmith@spec.com
Systems & Processes Engineering Corp. (SPEC)  Voice:(512) 306-1100 x154
401 Camp Craft Road                           Fax: (512) 306-1122
Austin, TX  78746-6558                        Web: http://www.spec.com


[Index of Archives]     [Yosemite]     [Yosemite Campsites]     [Bugtraq]     [Linux]     [Trn]

Powered by Linux