diff options
author | Samuel Thibault <samuel.thibault@ens-lyon.org> | 2013-06-29 22:10:09 +0200 |
---|---|---|
committer | Samuel Thibault <samuel.thibault@ens-lyon.org> | 2013-06-29 22:10:09 +0200 |
commit | 26b18d8e7d8bb5f1bf9ae20e40e8b291db3cebd6 (patch) | |
tree | 3e1be24516bc34ce4e4b8b3973f74dc4c86c9c15 /main.c | |
parent | 9288839793069e589615e4bb47257b63501586ae (diff) | |
download | hurd-26b18d8e7d8bb5f1bf9ae20e40e8b291db3cebd6.tar.gz hurd-26b18d8e7d8bb5f1bf9ae20e40e8b291db3cebd6.tar.bz2 hurd-26b18d8e7d8bb5f1bf9ae20e40e8b291db3cebd6.zip |
procfs: fix the error handling in argp_parser
Do not exit using error (1, ..) but gracefully handle the error using
argp_error. Also fix a typo ("the a user") while touching these lines.
* procfs/main.c (argp_parser): Proper error handling.
(argp_parser): Fix typo.
Diffstat (limited to 'main.c')
-rw-r--r-- | main.c | 12 |
1 files changed, 6 insertions, 6 deletions
@@ -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 " + "a user name or a numeric UID."); break; } |