diff options
Diffstat (limited to 'selinux')
-rw-r--r-- | selinux/sestatus.c | 26 |
1 files changed, 6 insertions, 20 deletions
diff --git a/selinux/sestatus.c b/selinux/sestatus.c index 3b027eeb2..1351600c8 100644 --- a/selinux/sestatus.c +++ b/selinux/sestatus.c | |||
@@ -47,31 +47,17 @@ static void display_boolean(void) | |||
47 | 47 | ||
48 | static void read_config(char **pc, int npc, char **fc, int nfc) | 48 | static void read_config(char **pc, int npc, char **fc, int nfc) |
49 | { | 49 | { |
50 | char buf[256]; | 50 | char *buf; |
51 | FILE *fp; | 51 | parser_t *parser; |
52 | int pc_ofs = 0, fc_ofs = 0, section = -1; | 52 | int pc_ofs = 0, fc_ofs = 0, section = -1; |
53 | 53 | ||
54 | pc[0] = fc[0] = NULL; | 54 | pc[0] = fc[0] = NULL; |
55 | 55 | ||
56 | fp = fopen("/etc/sestatus.conf", "rb"); | 56 | parser = config_open("/etc/sestatus.conf"); |
57 | if (fp == NULL) | 57 | if (!parser) |
58 | return; | 58 | return; |
59 | 59 | ||
60 | while (fgets(buf, sizeof(buf), fp) != NULL) { | 60 | while (config_read(parser, &buf, 1, 1, "# \t", PARSE_LAST_IS_GREEDY)) { |
61 | int i, c; | ||
62 | |||
63 | /* kills comments */ | ||
64 | for (i = 0; (c = buf[i]) != '\0'; i++) { | ||
65 | if (c == '#') { | ||
66 | buf[i] = '\0'; | ||
67 | break; | ||
68 | } | ||
69 | } | ||
70 | trim(buf); | ||
71 | |||
72 | if (buf[0] == '\0') | ||
73 | continue; | ||
74 | |||
75 | if (strcmp(buf, "[process]") == 0) { | 61 | if (strcmp(buf, "[process]") == 0) { |
76 | section = 1; | 62 | section = 1; |
77 | } else if (strcmp(buf, "[files]") == 0) { | 63 | } else if (strcmp(buf, "[files]") == 0) { |
@@ -86,7 +72,7 @@ static void read_config(char **pc, int npc, char **fc, int nfc) | |||
86 | } | 72 | } |
87 | } | 73 | } |
88 | } | 74 | } |
89 | fclose(fp); | 75 | config_close(parser); |
90 | } | 76 | } |
91 | 77 | ||
92 | static void display_verbose(void) | 78 | static void display_verbose(void) |