diff options
| author | William Hubbs <w.d.hubbs@gmail.com> | 2018-02-20 16:35:50 -0600 | 
|---|---|---|
| committer | William Hubbs <w.d.hubbs@gmail.com> | 2018-02-20 16:35:50 -0600 | 
| commit | c1178c8eebb92c9f3702e981cd4af9ef41f51884 (patch) | |
| tree | 242445213f981d122a04f3f567e3af70966876e8 /src | |
| parent | 3c031ca9780c555817fe9ccb8b23ceb231129724 (diff) | |
| download | openrc-c1178c8eebb92c9f3702e981cd4af9ef41f51884.tar.xz | |
rc-selinux.c: remove references to path_max
Diffstat (limited to 'src')
| -rw-r--r-- | src/rc/rc-selinux.c | 7 | 
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;  } | 
