Useless test

Denys Vlasenko vda.linux at googlemail.com
Fri Sep 28 22:02:40 UTC 2007


On Friday 28 September 2007 03:49, Loïc Grenié wrote:
>      The if () test is useless because it has already been done above.


                if (flags & (PSSCAN_CMD|PSSCAN_ARGV0)) {
                        if (sp->argv0) {
                                free(sp->argv0);
                                sp->argv0 = NULL;
                        }
                        if (sp->cmd) {
                                free(sp->cmd);
                                sp->cmd = NULL;
                        }
                        strcpy(filename_tail, "/cmdline");
                        /* TODO: to get rid of size limits, read into malloc buf,
                         * then realloc it down to real size. */
                        n = read_to_buf(filename, buf);
                        if (n <= 0)
                                break;
                        if (flags & PSSCAN_ARGV0)
                                sp->argv0 = xstrdup(buf);


I do not see why (flags & PSSCAN_ARGV0) is true in last if().
--
vda



More information about the busybox mailing list