bug-hurd
[Top][All Lists]
Advanced

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

[PATCH] Gracefully handle errors using argp_error().


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.

Attachment: mboxfs.patch
Description: Text Data

Attachment: notice.patch
Description: Text Data

Attachment: tarfs.patch
Description: Text Data

Attachment: unionfs.patch
Description: Text Data


reply via email to

[Prev in Thread] Current Thread [Next in Thread]