summaryrefslogtreecommitdiff
path: root/privs.c
blob: ac4ad25c337b2db978b5a9e76cefc2218e7eb07f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#include <unistd.h>
#include <sys/types.h>

#include "privs.h"
#include "die.h"

void drop_privileges(bool enforce, uid_t uid, gid_t gid)
{
	if (enforce) {
		if (uid == getuid())
			panic("Uid cannot be the same as the current user!\n");
		if (gid == getgid())
			panic("Gid cannot be the same as the current user!\n");
	}
	if (setgid(gid) != 0)
		panic("Unable to drop group privileges: %s!\n", strerror(errno));
	if (setuid(uid) != 0)
		panic("Unable to drop user privileges: %s!\n", strerror(errno));
}
1cb3caa29505f0'>patch) tree6d631490e0b6350dd5770c17db492911b84013bf parent13b3fde808ed287ad23c4549733fb3e3be785114 (diff)
regulator: use of_property_read_{bool|u32}()
Use more compact of_property_read_{bool|u32}() calls instead of the of_{find|get}_property() calls in of_get_regulation_constraints() where possible (note that of_property_read_{bool|u32}() were already used to read some properties). Signed-off-by: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com> Signed-off-by: Mark Brown <broonie@linaro.org>
Diffstat