diff options
author | Eamon Walsh <ewalsh@tycho.nsa.gov> | 2008-12-18 15:08:42 -0500 |
---|---|---|
committer | Eamon Walsh <ewalsh@tycho.nsa.gov> | 2008-12-18 15:08:42 -0500 |
commit | 31dc3b2ee71319283be4dac4b62a2ec027bcf5c1 (patch) | |
tree | fb0da07d0ee0b278694061dab85c11ff7f98b83f | |
parent | 97446481d42a90ceb47561b877c3f9fc8100fe5a (diff) |
Temporarily construct the secolor.conf path ourselves.
Need to add the path to libselinux eventually to avoid this.
-rw-r--r-- | src/mcscolor.c | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/src/mcscolor.c b/src/mcscolor.c index abc142d..f4be97c 100644 --- a/src/mcscolor.c +++ b/src/mcscolor.c @@ -246,6 +246,24 @@ static int process_color(char *buffer, int line) { return 0; } +static char *get_color_path(void) +{ + static char path[256]; + char *poltype; + int rc; + + *path = '\0'; + + rc = selinux_getpolicytype(&poltype); + if (rc == 0) { + strncat(path, "/etc/selinux/", 16); + strncat(path, poltype, 128); + strncat(path, "/secolor.conf", 16); + } + syslog(LOG_ERR, "%s", path); + return path; +} + /* Read in color file. */ int init_colors(void) { @@ -256,7 +274,7 @@ int init_colors(void) { getcon(&my_context); - cfg = fopen("/etc/selinux/refpolicy/secolor.conf", "r"); + cfg = fopen(get_color_path(), "r"); if (!cfg) return 1; __fsetlocking(cfg, FSETLOCKING_BYCALLER); |