summaryrefslogtreecommitdiffstats
path: root/src/daemon/privsep.c
blob: 04c49a947920111c7c52c8db947591fb4bd1c43d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
/* -*- mode: c; c-file-style: "openbsd" -*- */

#include "lldpd.h"

static int privileged, unprivileged;
void
priv_privileged_fd(int fd)
{
	privileged = fd;
}
void
priv_unprivileged_fd(int fd)
{
	unprivileged = fd;
}
int
priv_fd(enum priv_context ctx)
{
	switch (ctx) {
	case PRIV_PRIVILEGED:
		return privileged;
	case PRIV_UNPRIVILEGED:
		return unprivileged;
	}
	return -1; /* Not possible */
}