[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[hurd] 15/25: Avoid fatal error handling in option parsers.
From: |
Samuel Thibault |
Subject: |
[hurd] 15/25: Avoid fatal error handling in option parsers. |
Date: |
Mon, 24 Oct 2016 00:16:45 +0000 |
This is an automated email from the git hooks/post-receive script.
sthibault pushed a commit to branch upstream
in repository hurd.
commit 3a3c1759297d3621663571dc85d2fb5d1d53b3b1
Author: Justus Winter <address@hidden>
Date: Wed Oct 5 10:24:59 2016 +0200
Avoid fatal error handling in option parsers.
* trans/crash.c (parse_opt): Avoid 'error' in favor of the appropriate
argp error reporting mechanism.
* trans/remap.c (parse_opt): Likewise.
* utils/msgids.c (parse_opt): Likewise.
---
trans/crash.c | 5 ++++-
trans/remap.c | 6 +++++-
utils/msgids.c | 5 ++++-
3 files changed, 13 insertions(+), 3 deletions(-)
diff --git a/trans/crash.c b/trans/crash.c
index 14783cf..3c24451 100644
--- a/trans/crash.c
+++ b/trans/crash.c
@@ -640,7 +640,10 @@ parse_opt (int opt, char *arg, struct argp_state *state)
{
char *errp;
if (! template_valid (arg, &errp))
- error (1, 0, "Invalid template: ...'%s'", errp);
+ {
+ argp_error (state, "Invalid template: ...'%s'", errp);
+ return EINVAL;
+ }
}
corefile_template = arg;
break;
diff --git a/trans/remap.c b/trans/remap.c
index 63434f0..5afbaa0 100644
--- a/trans/remap.c
+++ b/trans/remap.c
@@ -98,7 +98,11 @@ parse_opt (int key, char *arg, struct argp_state *state)
{
case ARGP_KEY_ARG:
if (arg[0] != '/')
- error (1, 0, "remap only works with absolute paths\n");
+ {
+ argp_error (state, "remap only works with absolute paths: %s",
+ arg);
+ return EINVAL;
+ }
/* Skip heading slashes */
while (arg[0] == '/')
diff --git a/utils/msgids.c b/utils/msgids.c
index 4bc08de..d17f131 100644
--- a/utils/msgids.c
+++ b/utils/msgids.c
@@ -200,7 +200,10 @@ static error_t parse_opt (int key, char *arg, struct
argp_state *state)
case 'i':
if (argz_add (&msgids_files_argz, &msgids_files_argz_len,
arg) != 0)
- error (1, errno, "argz_add");
+ {
+ argp_failure (state, 1, errno, "argz_add");
+ return errno;
+ }
break;
case 'I':
--
Alioth's /usr/local/bin/git-commit-notice on
/srv/git.debian.org/git/pkg-hurd/hurd.git
- [hurd] 01/25: remap: Refuse non-absolute paths, (continued)
- [hurd] 01/25: remap: Refuse non-absolute paths, Samuel Thibault, 2016/10/23
- [hurd] 04/25: Fix message about not being able to request shutdown notification, Samuel Thibault, 2016/10/23
- [hurd] 02/25: typo, Samuel Thibault, 2016/10/23
- [hurd] 07/25: Fix looping over runsystem possibilities, Samuel Thibault, 2016/10/23
- [hurd] 03/25: Fix exec crash when setexecdata has never been called, Samuel Thibault, 2016/10/23
- [hurd] 05/25: exec: Fix loading binaries without a memory manager object, Samuel Thibault, 2016/10/23
- [hurd] 10/25: Fix patch to runsystem.hurd, Samuel Thibault, 2016/10/23
- [hurd] 20/25: console-client: Remove unused variable., Samuel Thibault, 2016/10/23
- [hurd] 19/25: ext2fs: Poison pointers into dereferenced cache pages., Samuel Thibault, 2016/10/23
- [hurd] 08/25: libfshelp: acquire references to control ports, Samuel Thibault, 2016/10/23
- [hurd] 15/25: Avoid fatal error handling in option parsers.,
Samuel Thibault <=
- [hurd] 25/25: boot: Ignore EINTR., Samuel Thibault, 2016/10/23
- [hurd] 24/25: Avoid warnings if increasing a threads priority fails., Samuel Thibault, 2016/10/23
- [hurd] 18/25: ext2fs: Rename parameter., Samuel Thibault, 2016/10/23
- [hurd] 09/25: Fix installing runsystem.hurd, Samuel Thibault, 2016/10/23
- [hurd] 12/25: fakeroot: set FAKED_MODE, Samuel Thibault, 2016/10/23
- [hurd] 14/25: ext2fs: Disable option to specify alternate superblock., Samuel Thibault, 2016/10/23
- [hurd] 17/25: trans/crash: Fix setting core file template at runtime., Samuel Thibault, 2016/10/23
- [hurd] 21/25: fshelp: Fix fetching the control port., Samuel Thibault, 2016/10/23
- [hurd] 06/25: startup: Fix looping over runsystem, Samuel Thibault, 2016/10/23
- [hurd] 16/25: trans/crash: Use empty core file templates to disable the feature., Samuel Thibault, 2016/10/23