diff options
author | Denis Vlasenko | 2008-07-20 17:48:59 +0000 |
---|---|---|
committer | Denis Vlasenko | 2008-07-20 17:48:59 +0000 |
commit | a34f1ed737e79e494904706e59f4e7fbb49e32b3 (patch) | |
tree | 9c84f928e785775d99163b7de5c29e6f85a0fc8c /selinux/sestatus.c | |
parent | 1e8034e61432cb3bd4bde1d7a13e809543a1e239 (diff) | |
download | busybox-a34f1ed737e79e494904706e59f4e7fbb49e32b3.zip busybox-a34f1ed737e79e494904706e59f4e7fbb49e32b3.tar.gz |
dnsd,sestatus: use libbb to parse config file (by Vladimir)
function old new delta
dnsd_main 1544 1487 -57
Diffstat (limited to 'selinux/sestatus.c')
-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 3b027ee..1351600 100644 --- a/selinux/sestatus.c +++ b/selinux/sestatus.c @@ -47,31 +47,17 @@ 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) + parser = config_open("/etc/sestatus.conf"); + if (!parser) 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; - + while (config_read(parser, &buf, 1, 1, "# \t", PARSE_LAST_IS_GREEDY)) { if (strcmp(buf, "[process]") == 0) { section = 1; } else if (strcmp(buf, "[files]") == 0) { @@ -86,7 +72,7 @@ static void read_config(char **pc, int npc, char **fc, int nfc) } } } - fclose(fp); + config_close(parser); } static void display_verbose(void) |