forked from smack-team/smack
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsmackcipso.c
54 lines (49 loc) · 1.29 KB
/
smackcipso.c
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
53
54
/*
* This file is part of libsmack
*
* Copyright (C) 2011 Intel Corporation
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public License
* version 2.1 as published by the Free Software Foundation.
*
* This library is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA
*
* Authors:
* Brian McGillion <[email protected]>
*/
#include "common.h"
#include <stdlib.h>
#include <stdio.h>
#include <unistd.h>
int main(int argc, char **argv)
{
if (is_smackfs_mounted() != 1) {
fprintf(stderr, "SmackFS is not mounted.\n");
exit(1);
}
if (argc > 2) {
fprintf(stderr, "Usage: %s <path>\n", argv[0]);
exit(1);
}
if (argc == 1) {
if (apply_cipso_file(STDIN_FILENO)) {
perror("apply_cipso_file");
exit(1);
}
} else {
if (apply_cipso(argv[1])) {
perror("apply_cipso");
exit(1);
}
}
exit(0);
}