Follow-up on nft_print() enhancement
Phil Sutter
reviewercover Follow-up on nft_print() enhancement
This fixes two spots I forgot to clean up before submitting the patches.
Phil Sutter (2):
main: Flush output from nft_gmp_print()
main: Drop stdout hack to expose nft_print() implementation issues
src/main.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
Signature · 1 line
2.13.1
Phil Sutter
reviewerPATCH 1/2 main: Flush output from nft_gmp_print()
This adds a missing call to fflush() to nft_gmp_print() just like in nft_print(). This is strictly not necessary since usually nft_gmp_print() is followed by a call to nft_print() but better not rely upon this assumption.
--- src/main.c | 1 + 1 file changed, 1 insertion(+)
src/main.c +1 -0
@@ -403,6 +403,7 @@ int nft_gmp_print(struct output_ctx *octx, const char *fmt, ...)va_start (arg, fmt); ret =gmp_vfprintf (octx->output_fp, fmt, arg);va_end (arg); +fflush (octx->output_fp);return ret; }
Signature · 1 line
2.13.1
Phil Sutter
reviewerPATCH 2/2 main: Drop stdout hack to expose nft_print() implementation issues
In reply to Phil SutterThis was helpful when testing nft_print() implementation, but breaks 'nft --help' output. Also, with this in place typical printf-debugging would have to use stderr at all times which is confusing at least.
--- src/main.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
src/main.c +1 -3
@@ -415,11 +415,9 @@ int main(int argc, char * const *argv)bool interactive = false;struct parser_state state;int i, val, rc; -FILE *outfp =fdopen (dup (STDOUT_FILENO ),"w" ); nft =nft_ctx_new (NFT_CTX_DEFAULT ); -nft_ctx_set_output (nft, outfp); -close (STDOUT_FILENO ); +nft_ctx_set_output (nft, stdout);while (1 ) { val =getopt_long (argc, argv,OPTSTRING , options,NULL );
Signature · 1 line
2.13.1
Quoted 1 line · Phil Sutter
This fixes two spots I forgot to clean up before submitting the patches.
Applied, thanks Phil.