[prev in list] [next in list] [prev in thread] [next in thread]
List: busybox
Subject: Re: [PATCH] build system: prevent duplicate applet names
From: Denys Vlasenko <vda.linux () googlemail ! com>
Date: 2018-11-27 9:56:19
Message-ID: CAK1hOcMAEN9E8kAZHJ5k21W3WA94FusLvKjXCbCtqAqguGf=dw () mail ! gmail ! com
[Download RAW message or body]
Applied, thanks!
On Sun, Nov 25, 2018 at 12:46 PM Ron Yorston <rmy@pobox.com> wrote:
>
> The embedded script feature makes it easier to create applets with
> duplicate names. Currently in such cases the build succeeds but
> the resulting executable doesn't work as the developer intended.
>
> Catch duplicate names when the applet tables are being generated
> and make the build fail.
>
> Signed-off-by: Ron Yorston <rmy@pobox.com>
> ---
> applets/applet_tables.c | 10 +++++++++-
> 1 file changed, 9 insertions(+), 1 deletion(-)
>
> diff --git a/applets/applet_tables.c b/applets/applet_tables.c
> index e3d10c83f..ce2037440 100644
> --- a/applets/applet_tables.c
> +++ b/applets/applet_tables.c
> @@ -84,7 +84,15 @@ int main(int argc, char **argv)
>
> qsort(applets, NUM_APPLETS, sizeof(applets[0]), cmp_name);
>
> - if (!argv[1])
> + for (i = j = 0; i < NUM_APPLETS-1; ++i) {
> + if (cmp_name(applets+i, applets+i+1) == 0) {
> + fprintf(stderr, "%s: duplicate applet name '%s'\n", argv[0],
> + applets[i].name);
> + j = 1;
> + }
> + }
> +
> + if (j != 0 || !argv[1])
> return 1;
> snprintf(tmp1, PATH_MAX, "%s.%u.new", argv[1], (int) getpid());
> i = open(tmp1, O_WRONLY | O_TRUNC | O_CREAT, 0666);
> --
> 2.19.1
>
> _______________________________________________
> busybox mailing list
> busybox@busybox.net
> http://lists.busybox.net/mailman/listinfo/busybox
_______________________________________________
busybox mailing list
busybox@busybox.net
http://lists.busybox.net/mailman/listinfo/busybox
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic