summaryrefslogtreecommitdiffstats
path: root/ip6tables.c
diff options
context:
space:
mode:
authorHarald Welte <laforge@gnumonks.org>2003-03-05 07:46:15 +0000
committerHarald Welte <laforge@gnumonks.org>2003-03-05 07:46:15 +0000
commita8658ca43fba82f7761f774f4daeb29b3e335053 (patch)
tree5d81ac1fa9c04b787e395b0f6fa9d93d039edb3d /ip6tables.c
parent2354d928a6864e8753decc054873d562689577d3 (diff)
port 'line number on error in iptables-restore' from ipv4
Diffstat (limited to 'ip6tables.c')
-rw-r--r--ip6tables.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/ip6tables.c b/ip6tables.c
index 6ee460b2..17bdb4e5 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);