* [Powertop] [PATCH] ccstoh: Don't return success if something went wrong
@ 2012-07-12 20:41 Stefan Weil
0 siblings, 0 replies; 2+ messages in thread
From: Stefan Weil @ 2012-07-12 20:41 UTC (permalink / raw)
To: powertop
[-- Attachment #1: Type: text/plain, Size: 926 bytes --]
exit(0) is the same as returning EXIT_SUCCESS which is a bad
idea after a severe failure. It will for example result in
wrong behaviour of make (make won't stop after such failures).
Returning EXIT_FAILURE fixes this.
Signed-off-by: Stefan Weil <sw(a)weilnetz.de>
---
src/csstoh.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/csstoh.c b/src/csstoh.c
index e6b1dcf..28858f5 100644
--- a/src/csstoh.c
+++ b/src/csstoh.c
@@ -40,12 +40,12 @@ int main(int argc, char **argv)
in = fopen(argv[1], "rm");
if (!in) {
printf("Failed to open input file %s (%s) \n", argv[1], strerror(errno));
- exit(0);
+ return EXIT_FAILURE;
}
out = fopen(argv[2], "wm");
if (!out) {
printf("Failed to open output file %s (%s) \n", argv[1], strerror(errno));
- exit(0);
+ return EXIT_FAILURE;
}
fprintf(out, "#ifndef __INCLUDE_GUARD_CCS_H\n");
--
1.7.10
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [Powertop] [PATCH] ccstoh: Don't return success if something went wrong
@ 2012-07-17 22:07 Chris Ferron
0 siblings, 0 replies; 2+ messages in thread
From: Chris Ferron @ 2012-07-17 22:07 UTC (permalink / raw)
To: powertop
[-- Attachment #1: Type: text/plain, Size: 1067 bytes --]
On 07/12/2012 01:41 PM, Stefan Weil wrote:
> exit(0) is the same as returning EXIT_SUCCESS which is a bad
> idea after a severe failure. It will for example result in
> wrong behaviour of make (make won't stop after such failures).
>
> Returning EXIT_FAILURE fixes this.
>
> Signed-off-by: Stefan Weil <sw(a)weilnetz.de>
> ---
> src/csstoh.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/src/csstoh.c b/src/csstoh.c
> index e6b1dcf..28858f5 100644
> --- a/src/csstoh.c
> +++ b/src/csstoh.c
> @@ -40,12 +40,12 @@ int main(int argc, char **argv)
> in = fopen(argv[1], "rm");
> if (!in) {
> printf("Failed to open input file %s (%s) \n", argv[1], strerror(errno));
> - exit(0);
> + return EXIT_FAILURE;
> }
> out = fopen(argv[2], "wm");
> if (!out) {
> printf("Failed to open output file %s (%s) \n", argv[1], strerror(errno));
> - exit(0);
> + return EXIT_FAILURE;
> }
>
> fprintf(out, "#ifndef __INCLUDE_GUARD_CCS_H\n");
Your patch has been merged.
Thank you,
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2012-07-17 22:07 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-07-17 22:07 [Powertop] [PATCH] ccstoh: Don't return success if something went wrong Chris Ferron
-- strict thread matches above, loose matches on Subject: below --
2012-07-12 20:41 Stefan Weil
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.