Re: [PATCH 1/3] iptables: fix error reporting with wrong/missing arguments

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wednesday 2008-11-19 00:43, Pablo Neira Ayuso wrote:
>@@ -1888,9 +1888,26 @@ int do_command6(int argc, char *argv[], char **table, ip6tc_handle_t *handle)
> 					continue;
> 				}
> 
>-				if (!m)
>+				if (!m) {
>+					if (c == '?') {
>+						if (optopt) {
>+							exit_error(
>+							   PARAMETER_PROBLEM,
>+							   "option `%s' "
>+							   "requires an "
>+							   "argument",
>+							   argv[optind-1]);
>+						} else {
>+							exit_error(
>+							   PARAMETER_PROBLEM,
>+							   "unknown option "
>+							   "`%s'",
>+							   argv[optind-1]);
>+						}
>+					}
> 					exit_error(PARAMETER_PROBLEM,
> 						   "Unknown arg `%s'", optarg);
>+				}

I think it is time to give attention to CodingStyle section 1:

	“The answer to that is that if you need more than 3 levels of
	indentation, you're screwed anyway, and should fix your
	program.”

Maybe this could be put into a separate function somehow than trying
to squeeze everything between colums 64 and 80?
--
To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Netfitler Users]     [LARTC]     [Bugtraq]     [Yosemite Forum]

  Powered by Linux