[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH 1/6] procfs: fix the error handling in argp_parser
From: |
Emilio Pozuelo Monfort |
Subject: |
Re: [PATCH 1/6] procfs: fix the error handling in argp_parser |
Date: |
Thu, 27 Jun 2013 16:47:40 +0200 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130518 Icedove/17.0.5 |
Hi,
On 27/06/13 14:31, Justus Winter wrote:
> Do not exit using error (1, ..) but gracefully handle the error using
> argp_error.
>
> * procfs/main.c (argp_parser): Proper error handling.
> ---
> procfs/main.c | 12 ++++++------
> 1 file changed, 6 insertions(+), 6 deletions(-)
>
> diff --git a/procfs/main.c b/procfs/main.c
> index 3a976cc..e7f8574 100644
> --- a/procfs/main.c
> +++ b/procfs/main.c
> @@ -48,13 +48,13 @@ argp_parser (int key, char *arg, struct argp_state *state)
> case 'h':
> opt_clk_tck = strtol (arg, &endp, 0);
> if (*endp || ! *arg || opt_clk_tck <= 0)
> - error (1, 0, "--clk-tck: HZ should be a positive integer");
> + argp_error (state, "--clk-tck: HZ should be a positive integer");
> break;
>
> case 's':
> opt_stat_mode = strtol (arg, &endp, 8);
> if (*endp || ! *arg || opt_stat_mode & ~07777)
> - error (1, 0, "--stat-mode: MODE should be an octal mode");
> + argp_error (state, "--stat-mode: MODE should be an octal mode");
> break;
>
> case 'S':
> @@ -62,7 +62,7 @@ argp_parser (int key, char *arg, struct argp_state *state)
> {
> opt_fake_self = strtol (arg, &endp, 0);
> if (*endp || ! *arg)
> - error (1, 0, "--fake-self: PID must be an integer");
> + argp_error (state, "--fake-self: PID must be an integer");
> }
> else
> opt_fake_self = 1;
> @@ -71,7 +71,7 @@ argp_parser (int key, char *arg, struct argp_state *state)
> case 'k':
> opt_kernel_pid = strtol (arg, &endp, 0);
> if (*endp || ! *arg || (signed) opt_kernel_pid < 0)
> - error (1, 0, "--kernel-process: PID must be a positive integer");
> + argp_error (state, "--kernel-process: PID must be a positive integer");
> break;
>
> case 'c':
> @@ -90,8 +90,8 @@ argp_parser (int key, char *arg, struct argp_state *state)
>
> opt_anon_owner = strtol (arg, &endp, 0);
> if (*endp || ! *arg || (signed) opt_anon_owner < 0)
> - error(1, 0, "--anonymous-owner: USER should be the a user name "
> - "or a numeric UID.");
> + argp_error (state, "--anonymous-owner: USER should be the "
> + "a user name or a numeric UID.");
There's a typo here, "the a user". It was already there, but you may fix it
while at it.
Emilio
> break;
> }
>
>
- some work on procfs, Justus Winter, 2013/06/27
- [PATCH 1/6] procfs: fix the error handling in argp_parser, Justus Winter, 2013/06/27
- Re: [PATCH 1/6] procfs: fix the error handling in argp_parser,
Emilio Pozuelo Monfort <=
- [PATCH 1/6] procfs: fix the error handling in argp_parser, Justus Winter, 2013/06/28
- [PATCH 3/6] procfs: enable fsys_set_options, Justus Winter, 2013/06/28
- [PATCH 2/6] procfs: keep old config values if the parsing fails, Justus Winter, 2013/06/28
- [PATCH 5/6] procfs: define macros for the default argument values, Justus Winter, 2013/06/28
- [PATCH 4/6] procfs: handle the --update parameter, Justus Winter, 2013/06/28
- [PATCH 6/6] procfs: provide a more meaningful response to fsys_get_options, Justus Winter, 2013/06/28
- Re: [PATCH 1/6] procfs: fix the error handling in argp_parser, Samuel Thibault, 2013/06/29
- Re: [PATCH 1/6] procfs: fix the error handling in argp_parser, Justus Winter, 2013/06/29
- Re: [PATCH 1/6] procfs: fix the error handling in argp_parser, Samuel Thibault, 2013/06/30
[PATCH 2/6] procfs: keep old config values if the parsing fails, Justus Winter, 2013/06/27