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));
}
e='this.form.submit();'>mode:
authorMike Manning <michael@bsch.com.au>2016-04-18 12:13:23 +0000
committerJohan Hovold <johan@kernel.org>2016-04-24 11:06:23 +0200
commit1d377f4d690637a0121eac8701f84a0aa1e69a69 (patch)
tree7223e49b18bbb4292b300d774f233852f83fb5aa /Documentation/devicetree
parentc3b46c73264b03000d1e18b22f5caf63332547c9 (diff)
USB: serial: cp210x: add ID for Link ECU
The Link ECU is an aftermarket ECU computer for vehicles that provides full tuning abilities as well as datalogging and displaying capabilities via the USB to Serial adapter built into the device. Signed-off-by: Mike Manning <michael@bsch.com.au> Cc: stable <stable@vger.kernel.org> Signed-off-by: Johan Hovold <johan@kernel.org>
Diffstat (limited to 'Documentation/devicetree')