[PATCH v3 3/4] nsenter: new applet
Mike Frysinger
vapier at gentoo.org
Mon Mar 14 14:27:19 UTC 2016
On 14 Mar 2016 11:07, Bartosz Golaszewski wrote:
> +#ifndef __BB_NAMESPACE_H
> +#define __BB_NAMESPACE_H
use a naming style like other busybox headers
> +/*
> + * Longest possible path to a procfs file used in namespace utils. Must be
> + * able to contain the '/proc/' string, the '/ns/user' string which is the
> + * longest namespace name and a 32-bit integer representing the process ID.
> + */
> +#define NS_PROC_PATH_MAX (sizeof("/proc//ns/user") + sizeof(pid_t) * 3)
using the sizeof pid_t as a proxy for how many chars it'd take to render
a decimal number in ASCII is wonky. just hardcode it as "10" since that
is the largest unsigned 32bit number ("4294967296").
> + status = setgid(gid);
> + if (status < 0)
> + bb_perror_msg_and_die("setgid failed");
use xsetgid
> + status = setuid(uid);
> + if (status < 0)
> + bb_perror_msg_and_die("setuid failed");
use xsetuid
-mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://lists.busybox.net/pipermail/busybox/attachments/20160314/c457faf2/attachment.asc>
More information about the busybox
mailing list