X-Git-Url: https://git.librecmc.org/?a=blobdiff_plain;f=selinux%2Fsestatus.c;h=eca557e4cae4af539191b2913352ceb3b6ef207d;hb=d4b719878f5a08986d0a3dc493aad90d4466752e;hp=3b027eeb21ab8fe592b2c3319c54baf4d93e169b;hpb=a60f84ebf07863e390b72a2b6150e461a1ec18e9;p=oweals%2Fbusybox.git diff --git a/selinux/sestatus.c b/selinux/sestatus.c index 3b027eeb2..eca557e4c 100644 --- a/selinux/sestatus.c +++ b/selinux/sestatus.c @@ -47,31 +47,14 @@ static void display_boolean(void) static void read_config(char **pc, int npc, char **fc, int nfc) { - char buf[256]; - FILE *fp; + char *buf; + parser_t *parser; int pc_ofs = 0, fc_ofs = 0, section = -1; pc[0] = fc[0] = NULL; - fp = fopen("/etc/sestatus.conf", "rb"); - if (fp == NULL) - return; - - while (fgets(buf, sizeof(buf), fp) != NULL) { - int i, c; - - /* kills comments */ - for (i = 0; (c = buf[i]) != '\0'; i++) { - if (c == '#') { - buf[i] = '\0'; - break; - } - } - trim(buf); - - if (buf[0] == '\0') - continue; - + parser = config_open("/etc/sestatus.conf"); + while (config_read(parser, &buf, 1, 1, "# \t", PARSE_NORMAL)) { if (strcmp(buf, "[process]") == 0) { section = 1; } else if (strcmp(buf, "[files]") == 0) { @@ -86,7 +69,7 @@ static void read_config(char **pc, int npc, char **fc, int nfc) } } } - fclose(fp); + config_close(parser); } static void display_verbose(void)