Hi

While building rsyslog I'm getting a probably-false warning:

rsyslogd.c: In function 'writePidFile':
rsyslogd.c:185:2: warning: ignoring return value of 'asprintf', declared with attribute warn_unused_result [-Wunused-result]
  asprintf((char **)&tmpPidFile, "%s.tmp", PidFile);
  ^

Checking https://github.com/rsyslog/rsyslog/blob/fee6141c5106e72cb3afd56e52400137927989b1/tools/rsyslogd.c#L185 seems it's properly surrounded by an if statement

   if(asprintf((char **)&tmpPidFile, "%s.tmp", PidFile) == -1) {


As I'm a newbie on this, I'm asking for an advice:

Do you think we should compare against <0 (despite what https://linux.die.net/man/3/asprintf says) ?

Shall we assign a variable and check?
    int r = asprintf((char **)&tmpPidFile, "%s.tmp", PidFile);
if( r == -1) {

Should I just ignore the warning, cause it will be gone with next compiler version?

This might be part of https://github.com/rsyslog/rsyslog/issues/1115


Regards

_______________________________________________
rsyslog mailing list
http://lists.adiscon.net/mailman/listinfo/rsyslog
http://www.rsyslog.com/professional-services/
What's up with rsyslog? Follow https://twitter.com/rgerhards
NOTE WELL: This is a PUBLIC mailing list, posts are ARCHIVED by a myriad of 
sites beyond our control. PLEASE UNSUBSCRIBE and DO NOT POST if you DON'T LIKE 
THAT.

Reply via email to