Re: [nft PATCH v2 5/5] src: get rid of printf

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

 



On Fri, Sep 29, 2017 at 12:57:35PM +0200, Phil Sutter wrote:
> Hi Pablo,
> 
> On Fri, Sep 29, 2017 at 12:38:15PM +0200, Pablo Neira Ayuso wrote:
> > On Thu, Sep 28, 2017 at 05:17:45PM +0200, Phil Sutter wrote:
> > > This patch introduces nft_print()/nft_gmp_print() functions which have
> > > to be used instead of printf to output information that were previously
> > > send to stdout. These functions print to a FILE pointer defined in
> > > struct output_ctx. It is set by calling:
> > > 
> > > | old_fp = nft_ctx_set_output(ctx, new_fp);
> > > 
> > > Having an application-defined FILE pointer is actually quite flexible:
> > > Using fmemopen() or even fopencookie(), an application gains full
> > > control over what is printed and where it should go to.
> > 
> > Applied, thanks a lot for taking over this work.
> 
> Cool, thanks!
> 
> Note that I missed two spots when reviewing the patches:
> 
> * nft_gmp_print() lacks a call to fflush(). This is not a problem in
>   practice, but inconsistent with regards to nft_print(). I'll send a
>   follow-up fixing it.

OK.

> * Did you notice how my patch changes main() to move stdout to another
>   file descriptor? I used that to make sure I didn't miss a spot when
>   converting the code. In theory, we could just drop it again since
>   everything's working. What do you suggest?

Please, drop it. Thanks.
--
To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Netfitler Users]     [LARTC]     [Bugtraq]     [Yosemite Forum]

  Powered by Linux