|
From: | Cyril Roelandt |
Subject: | [PATCH] Gracefully handle errors using argp_error(). |
Date: | Fri, 05 Jul 2013 01:25:26 +0200 |
User-agent: | Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130518 Icedove/17.0.5 |
Hello! After seeing this patch from Justus Winter: http://lists.gnu.org/archive/html/bug-hurd/2013-06/msg00120.html I wrote a Coccinelle script that finds similar errors: <smpl> @find_struct@ identifier argp_s; identifier argp_parser_func; identifier options; @@ ( struct argp argp_s = { .parser = argp_parser_func, }; | struct argp argp_s = { options, argp_parser_func, ... }; | argp_s->parser = argp_parser_func; | argp_s.parser = argp_parser_func; ) @depends on find_struct@ identifier find_struct.argp_parser_func; identifier state; expression E; @@ argp_parser_func (..., struct argp_state *state) { <... - error(..., + argp_error(state, E); ...> } </smpl>I found 4 programs that could be improved by gracefully handling errors using argp_error: notice (hurd-extras), mboxfs (hurd-extras), tarfs (incubator) and unionfs. The patches are attached.
Cyril Roelandt.
mboxfs.patch
Description: Text Data
notice.patch
Description: Text Data
tarfs.patch
Description: Text Data
unionfs.patch
Description: Text Data
[Prev in Thread] | Current Thread | [Next in Thread] |