2013/2/4 Zbigniew Jędrzejewski-Szmek <span dir="ltr"><<a href="mailto:zbyszek@in.waw.pl" target="_blank">zbyszek@in.waw.pl</a>></span><br><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div class="HOEnZb"><div class="h5">On Mon, Feb 04, 2013 at 03:13:25PM +0100, Mirco Tischler wrote:<br>
> ---<br>
> src/journal/coredump.c | 28 ++++++----------------------<br>
> 1 file changed, 6 insertions(+), 22 deletions(-)<br>
><br>
> diff --git a/src/journal/coredump.c b/src/journal/coredump.c<br>
> index 91528d3..4f79c45 100644<br>
> --- a/src/journal/coredump.c<br>
> +++ b/src/journal/coredump.c<br>
> @@ -32,6 +32,7 @@<br>
><br>
> #include "log.h"<br>
> #include "util.h"<br>
> +#include "macro.h"<br>
> #include "mkdir.h"<br>
> #include "special.h"<br>
> #include "cgroup-util.h"<br>
> @@ -49,7 +50,7 @@ enum {<br>
> };<br>
><br>
> static int divert_coredump(void) {<br>
> - FILE *f;<br>
> + _cleanup_fclose_ FILE *f = NULL;<br>
> int r;<br>
><br>
> log_info("Detected coredump of the journal daemon itself, diverting coredump to /var/lib/systemd/coredump/.");<br>
> @@ -94,21 +95,20 @@ static int divert_coredump(void) {<br>
> }<br>
><br>
> finish:<br>
> - fclose(f);<br>
> return r;<br>
> }<br>
><br>
</div></div>Hi,<br>
if you do that, than you can go one step further, and get rid of<br>
finish label. We don't enforce a single point of return, and it<br>
is easier to read 'return -errno' instead of 'r = -errno; ...; return r;'.<br>
<br>
Zbyszek<br>
</blockquote></div>Thanks for your comment; new patch following.<div>I tried the same for main() but return EXIT_FAILURE; all over the place just looks ugly in my eyes.</div><div><br></div><div>Mirco</div>