On Fri, May 26, 2017 at 12:25:16PM +0000, Oliver Ford wrote:
> Adds an option to output the results of iptables-save,
> ip6tables-save, and xtables-save save to a file.
> Updates the man page with this new option.
>
> Uses the dup2 call to replace stdout with the specified file.
> Error output is unchanged.
>
> This is a feature requested by a Gentoo developer in
> Bugzilla #905.
Applied, thanks.
One minor glitch here.
> @@ -159,6 +162,21 @@ int ip6tables_save_main(int argc, char *argv[])
> case 'M':
> xtables_modprobe_program = optarg;
> break;
> + case 'f':
> + file = fopen(optarg, "w");
> + if (file == NULL) {
> + fprintf(stderr, "Failed to open file, error:
> %s\n",
> + strerror(errno));
> + exit(1);
> + }
> + int ret = dup2(fileno(file), STDOUT_FILENO);
We prefer not to have variable declarations in the body. So I slightly
mangled your patch. See patch in the git repo for final version.
Thanks.
--
To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html