blob: 3728fd0b5094478ae5c5e5ccc34a3f751aa72062 (
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
27
28
29
30
31
32
33
34
|
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include <fcntl.h>
#include <unistd.h>
#include <errno.h>
#include <ctype.h>
#include <selinux/selinux.h>
#include "udev.h"
#include "udev_version.h"
#include "udev_selinux.h"
#include "logging.h"
void selinux_add_node(char *filename)
{
int retval;
if (is_selinux_enabled() > 0) {
security_context_t scontext;
retval = matchpathcon(filename, 0, &scontext);
if (retval < 0) {
dbg("matchpathcon(%s) failed\n", filename);
} else {
retval=setfilecon(filename,scontext);
if (retval < 0)
dbg("setfiles %s failed with error '%s'",
filename, strerror(errno));
free(scontext);
}
}
}
|