netfilter-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Felix Janda <felix.janda@posteo.de>
To: Jan Engelhardt <jengelh@inai.de>
Cc: netfilter-devel@vger.kernel.org
Subject: Re: [ulogd2 PATCH 3/4] ulogd: Use (FILE *)(-1) as dummy logfile when logging to syslog
Date: Sat, 16 May 2015 17:36:02 +0200	[thread overview]
Message-ID: <20150516153344.GA3410@euler> (raw)
In-Reply-To: <alpine.LSU.2.20.1505161658530.8092@nerf40.vanv.qr>

Jan Engelhardt wrote:
> On Saturday 2015-05-16 15:37, Felix Janda wrote:
> 
> >-static FILE syslog_dummy;
> >+#define SYSLOG_DUMMY ((FILE *)(-1))
> 
> ^This will likely introduce a "cast to pointer from integer of different 
> size" warning on LP64 targets.
> 
> syslog_dummy = fopen("/dev/null", "w");
> 
> would be, at the cost of one more open fd, a "nice" solution,
> since syslog_dummy is guaranteed to be unique, without making
> any assumptions about any magic value(s) being unused.

This seems seems like a cleaner approach.
Preparing a new patch...

> That, or turn the assumptive macro into
> 	#define SYSLOG_DUMMY ((FILE *)(intptr_t)-1)

Thanks,
Felix

      reply	other threads:[~2015-05-16 15:36 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-05-16 13:37 [ulogd2 PATCH 3/4] ulogd: Use (FILE *)(-1) as dummy logfile when logging to syslog Felix Janda
2015-05-16 15:01 ` Jan Engelhardt
2015-05-16 15:36   ` Felix Janda [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20150516153344.GA3410@euler \
    --to=felix.janda@posteo.de \
    --cc=jengelh@inai.de \
    --cc=netfilter-devel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).