Also move time() calls to where they are used. Signed-off-by: Phil Sutter <phil@xxxxxx> --- iptables/xtables-save.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/iptables/xtables-save.c b/iptables/xtables-save.c index 484450f03354f..ac452f1dd6f14 100644 --- a/iptables/xtables-save.c +++ b/iptables/xtables-save.c @@ -71,6 +71,7 @@ __do_output(struct nft_handle *h, const char *tablename, void *data) { struct nftnl_chain_list *chain_list; struct do_output_data *d = data; + time_t now; if (!nft_table_builtin_find(h, tablename)) return 0; @@ -85,19 +86,18 @@ __do_output(struct nft_handle *h, const char *tablename, void *data) if (!chain_list) return 0; - time_t now = time(NULL); - + now = time(NULL); printf("# Generated by %s v%s on %s", prog_name, prog_vers, ctime(&now)); - printf("*%s\n", tablename); + printf("*%s\n", tablename); /* Dump out chain names first, * thereby preventing dependency conflicts */ nft_chain_save(h, chain_list); nft_rule_save(h, tablename, d->counters ? 0 : FMT_NOCOUNTS); + printf("COMMIT\n"); now = time(NULL); - printf("COMMIT\n"); printf("# Completed on %s", ctime(&now)); return 0; } -- 2.22.0