On 17 Mar 2016 15:52, Bartosz Golaszewski wrote:
> +static void mount_procfs(const char *target)
> +{
> +     int status;
> +
> +     status = mount("none", target, NULL, MS_PRIVATE | MS_REC, NULL);
> +     if (status < 0)
> +             goto mount_err;
> +
> +     status = mount("proc", target, "proc",
> +                    MS_NOSUID | MS_NOEXEC | MS_NODEV, NULL);

each of these mount calls could do with a comment explaining what/why.
you & i might understand how /proc needs to be made private & then
freshly mounted in a new pid ns, but not everyone :).

> +     if (status < 0)
> +             goto mount_err;

general style note ... seems like this could be written:
        status = mount(...)
        if (status == 0)
                status = mount(...)
        if (status < 0)
                bb_perror_msg_and_die(...)

might be smaller code wise ?

> +     run_shell(getenv("SHELL"), 0, NULL, NULL);

if SHELL isn't set, then we just segfault ?
-mike

Attachment: signature.asc
Description: Digital signature

_______________________________________________
busybox mailing list
[email protected]
http://lists.busybox.net/mailman/listinfo/busybox

Reply via email to