From 22957be4f5b3b25393d0fc9656d0cb6a88005fb0 Mon Sep 17 00:00:00 2001 From: laforge Date: Wed, 5 Mar 2003 07:46:15 +0000 Subject: port 'line number on error in iptables-restore' from ipv4 --- ip6tables.c | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'ip6tables.c') diff --git a/ip6tables.c b/ip6tables.c index 6ee460b..17bdb4e 100644 --- a/ip6tables.c +++ b/ip6tables.c @@ -142,6 +142,12 @@ static struct option original_opts[] = { { 0 } }; +/* we need this for ip6tables-restore. ip6tables-restore.c sets line to the + * current line of the input file, in order to give a more precise error + * message. ip6tables itself doesn't need this, so it is initialized to the + * magic number of -1 */ +int line = -1; + #ifndef __OPTIMIZE__ struct ip6t_entry_target * ip6t_get_target(struct ip6t_entry *e) @@ -278,6 +284,8 @@ exit_error(enum exittype status, char *msg, ...) void exit_tryhelp(int status) { + if (line != -1) + fprintf(stderr, "Error occurred at line: %d\n", line); fprintf(stderr, "Try `%s -h' or '%s --help' for more information.\n", program_name, program_name ); exit(status); -- cgit v1.2.3