[OE-core] [PATCH] makedevs: rectify the exit codes and handle the invalid parameter

Khem Raj raj.khem at gmail.com
Wed Sep 25 14:27:00 UTC 2013


On Tuesday, September 24, 2013, wrote:

> From: Roy Li <rongqing.li at windriver.com <javascript:;>>
>
> It is correct behaviours to output help and version information,
> and should return 0;
> When input parameter is invalid, print help information and exit.


This can cause gripes for systems who have scripted the old behavior
And since it's a user visible change I would suggest to get it accepted
upstream before
It's applied in openembedded


> Signed-off-by: Roy Li <rongqing.li at windriver.com <javascript:;>>
> ---
>  meta/recipes-devtools/makedevs/makedevs-1.0.0/makedevs.c |    9 ++++++---
>  1 file changed, 6 insertions(+), 3 deletions(-)
>
> diff --git a/meta/recipes-devtools/makedevs/makedevs-1.0.0/makedevs.c
> b/meta/recipes-devtools/makedevs/makedevs-1.0.0/makedevs.c
> index cc3707b..5d2c45b 100644
> --- a/meta/recipes-devtools/makedevs/makedevs-1.0.0/makedevs.c
> +++ b/meta/recipes-devtools/makedevs/makedevs-1.0.0/makedevs.c
> @@ -465,8 +465,8 @@ int main(int argc, char **argv)
>                                 error_msg_and_die("%s: not a proper device
> table file", optarg);
>                         break;
>                 case 'h':
> -                       fprintf(stderr, helptext);
> -                       exit(1);
> +                       printf(helptext);
> +                       exit(0);
>                 case 'r':
>                 case 'd':                               /* for
> compatibility with mkfs.jffs, genext2fs, etc... */
>                         if (rootdir != default_rootdir) {
> @@ -476,8 +476,11 @@ int main(int argc, char **argv)
>                         break;
>
>                 case 'v':
> -                       fprintf(stderr, "makedevs revision %.*s\n",
> +                       printf("makedevs revision %.*s\n",
>                                         (int) strlen(revtext) - 13,
> revtext + 11);
> +                       exit(0);
> +               default:
> +                       fprintf(stderr, helptext);
>                         exit(1);
>                 }
>         }
> --
> 1.7.10.4
>
> _______________________________________________
> Openembedded-core mailing list
> Openembedded-core at lists.openembedded.org <javascript:;>
> http://lists.openembedded.org/mailman/listinfo/openembedded-core
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openembedded.org/pipermail/openembedded-core/attachments/20130925/56e232f6/attachment-0002.html>


More information about the Openembedded-core mailing list