aboutsummaryrefslogtreecommitdiff
path: root/src/rc
diff options
context:
space:
mode:
authorWilliam Hubbs <w.d.hubbs@gmail.com>2018-02-20 16:35:50 -0600
committerWilliam Hubbs <w.d.hubbs@gmail.com>2018-02-20 16:35:50 -0600
commitc1178c8eebb92c9f3702e981cd4af9ef41f51884 (patch)
tree242445213f981d122a04f3f567e3af70966876e8 /src/rc
parent3c031ca9780c555817fe9ccb8b23ceb231129724 (diff)
rc-selinux.c: remove references to path_max
Diffstat (limited to 'src/rc')
-rw-r--r--src/rc/rc-selinux.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/rc/rc-selinux.c b/src/rc/rc-selinux.c
index bfaf1556..2c9673cc 100644
--- a/src/rc/rc-selinux.c
+++ b/src/rc/rc-selinux.c
@@ -256,19 +256,19 @@ static int read_context_file(const char *filename, char **context)
{
int ret = -1;
FILE *fp;
- char filepath[PATH_MAX];
+ char *filepath = NULL;
char *line = NULL;
char *p;
char *p2;
size_t len = 0;
ssize_t read;
- memset(filepath, '\0', PATH_MAX);
- snprintf(filepath, PATH_MAX - 1, "%s/%s", selinux_contexts_path(), filename);
+ xasprintf(&filepath, "%s/%s", selinux_contexts_path(), filename);
fp = fopen(filepath, "r");
if (fp == NULL) {
eerror("Failed to open context file: %s", filename);
+ free(filepath);
return -1;
}
@@ -294,6 +294,7 @@ static int read_context_file(const char *filename, char **context)
}
free(line);
+ free(filepath);
fclose(fp);
return ret;
}