diff options
author | laforge <laforge> | 2003-03-03 08:08:37 +0000 |
---|---|---|
committer | laforge <laforge> | 2003-03-03 08:08:37 +0000 |
commit | 6b1dd80e6fc5de59a708eb87e2ea362bcfbb733a (patch) | |
tree | 4d7f9291c2ab6db9be14f83886a233361d83c381 /iptables.c | |
parent | a37c4fd6b48c0bdc676803f003b01e0f2bee61dd (diff) |
make iptables-restore print the line number in case of an error
(Illes Marci <marci@balabit.hu>)
Diffstat (limited to 'iptables.c')
-rw-r--r-- | iptables.c | 8 |
1 files changed, 8 insertions, 0 deletions
@@ -141,6 +141,12 @@ static struct option original_opts[] = { { 0 } }; +/* we need this for iptables-restore. iptables-restore.c sets line to the + * current line of the input file, in order to give a more precise error + * message. iptables itself doesn't need this, so it is initialized to the + * magic number of -1 */ +int line = -1; + #ifndef __OPTIMIZE__ struct ipt_entry_target * ipt_get_target(struct ipt_entry *e) @@ -330,6 +336,8 @@ exit_error(enum exittype status, char *msg, ...) void exit_tryhelp(int status) { + if (line =! -1) + fprintf(stderr, "Error occured at line: %d\n", line); fprintf(stderr, "Try `%s -h' or '%s --help' for more information.\n", program_name, program_name ); exit(status); |