blob: 13d97b095d167b3dcc9e390dc0a4de426e917ce8 (
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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
|
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <sys/ioctl.h>
#include <fcntl.h>
#include <getopt.h>
#include "acl_ioctl.h"
int SetAclEntry(struct acl_args *opt, unsigned int cmd)
{
int fd;
fd = open("/dev/"ACL_DEVNAME, O_RDONLY);
if (fd < 0)
{
printf("Open %s pseudo device failed\n","/dev/"ACL_DEVNAME);
return ACL_FAIL;
}
if(ioctl(fd, cmd, opt)<0)
{
printf("ACL_API: ioctl error\n");
close(fd);
return ACL_FAIL;
}
close(fd);
return ACL_SUCCESS;
}
int AclGetAllEntries(struct acl_list_args *opt)
{
int fd=0;
fd = open("/dev/"ACL_DEVNAME, O_RDONLY);
if (fd < 0)
{
printf("Open %s pseudo device failed\n","/dev/"ACL_DEVNAME);
return ACL_FAIL;
}
if(ioctl(fd, ACL_GET_ALL_ENTRIES, opt)<0)
{
printf("ACL_API: ioctl error\n");
close(fd);
return ACL_FAIL;
}
close(fd);
return ACL_SUCCESS;
}
|