Is argv[0] a typo? Shouldn't it be argv[i]?
On Thu, Aug 2, 2018, 12:05 PM Florian Obser <[email protected]> wrote:
> I have been told that this is going to fall into snaps soon. If you
> are doing weird (or normal) things with ifconfig, please test.
>
> In particular if you use rulefile.
>
> Thanks!
>
> diff --git ifconfig.c ifconfig.c
> index 9bfb1751aab..873aed5bcc7 100644
> --- ifconfig.c
> +++ ifconfig.c
> @@ -676,10 +676,13 @@ main(int argc, char *argv[])
> int create = 0;
> int Cflag = 0;
> int gflag = 0;
> + int found_rulefile = 0;
> int i;
>
> /* If no args at all, print all interfaces. */
> if (argc < 2) {
> + if (unveil(NULL, NULL) == -1)
> + err(1, "unveil");
> aflag = 1;
> printif(NULL, 0);
> return (0);
> @@ -721,6 +724,18 @@ main(int argc, char *argv[])
> } else if (strlcpy(name, *argv, sizeof(name)) >= IFNAMSIZ)
> errx(1, "interface name '%s' too long", *argv);
> argc--, argv++;
> +
> + for (i = 0; i < argc; i++) {
> + if (strcmp(argv[0], "rulefile") == 0) {
> + found_rulefile = 1;
> + break;
> + }
> + }
> +
> + if (!found_rulefile)
> + if (unveil(NULL, NULL) == -1)
> + err(1, "unveil");
> +
> if (argc > 0) {
> for (afp = rafp = afs; rafp->af_name; rafp++)
> if (strcmp(rafp->af_name, *argv) == 0) {
>
>
> --
> I'm not entirely sure you are real.
>
>