mirror of
https://github.com/SELinuxProject/selinux
synced 2025-01-18 03:10:50 +00:00
policycoreutils: label_file: style changes to make Eric happy.
Sometimes sticking to 80 characters sucks a lot. I don't care. Buy a wider monitor so I can read the code. Signed-off-by: Eric Paris <eparis@redhat.com> Acked-by: Dan Walsh <dwalsh@redhat.com>
This commit is contained in:
parent
24b31a9da5
commit
d4a39ca15b
@ -158,15 +158,12 @@ static int nodups_specs(struct saved_data *data, const char *path)
|
||||
for (ii = 0; ii < data->nspec; ii++) {
|
||||
curr_spec = &spec_arr[ii];
|
||||
for (jj = ii + 1; jj < data->nspec; jj++) {
|
||||
if ((!strcmp
|
||||
(spec_arr[jj].regex_str, curr_spec->regex_str))
|
||||
if ((!strcmp(spec_arr[jj].regex_str, curr_spec->regex_str))
|
||||
&& (!spec_arr[jj].mode || !curr_spec->mode
|
||||
|| spec_arr[jj].mode == curr_spec->mode)) {
|
||||
rc = -1;
|
||||
errno = EINVAL;
|
||||
if (strcmp
|
||||
(spec_arr[jj].lr.ctx_raw,
|
||||
curr_spec->lr.ctx_raw)) {
|
||||
if (strcmp(spec_arr[jj].lr.ctx_raw, curr_spec->lr.ctx_raw)) {
|
||||
COMPAT_LOG
|
||||
(SELINUX_ERROR,
|
||||
"%s: Multiple different specifications for %s (%s and %s).\n",
|
||||
@ -476,37 +473,41 @@ static int init(struct selabel_handle *rec, struct selinux_opt *opts,
|
||||
*/
|
||||
maxnspec = UINT_MAX / sizeof(spec_t);
|
||||
for (pass = 0; pass < 2; pass++) {
|
||||
lineno = 0;
|
||||
data->nspec = 0;
|
||||
data->ncomp = 0;
|
||||
while (getline(&line_buf, &line_len, fp) > 0
|
||||
&& data->nspec < maxnspec) {
|
||||
if (process_line(rec, path, prefix, line_buf,
|
||||
pass, ++lineno) != 0)
|
||||
|
||||
lineno = 0;
|
||||
while (getline(&line_buf, &line_len, fp) > 0) {
|
||||
if (data->nspec >= maxnspec)
|
||||
break;
|
||||
status = process_line(rec, path, prefix, line_buf, pass, ++lineno);
|
||||
if (status)
|
||||
goto finish;
|
||||
}
|
||||
|
||||
if (pass == 1 && rec->validating) {
|
||||
status = nodups_specs(data, path);
|
||||
if (status)
|
||||
goto finish;
|
||||
}
|
||||
|
||||
lineno = 0;
|
||||
if (homedirfp)
|
||||
while (getline(&line_buf, &line_len, homedirfp) > 0
|
||||
&& data->nspec < maxnspec) {
|
||||
if (process_line
|
||||
(rec, homedir_path, prefix,
|
||||
line_buf, pass, ++lineno) != 0)
|
||||
while (getline(&line_buf, &line_len, homedirfp) > 0) {
|
||||
if (data->nspec >= maxnspec)
|
||||
break;
|
||||
status = process_line(rec, homedir_path, prefix, line_buf, pass, ++lineno);
|
||||
if (status)
|
||||
goto finish;
|
||||
}
|
||||
|
||||
lineno = 0;
|
||||
if (localfp)
|
||||
while (getline(&line_buf, &line_len, localfp) > 0
|
||||
&& data->nspec < maxnspec) {
|
||||
if (process_line
|
||||
(rec, local_path, prefix, line_buf,
|
||||
pass, ++lineno) != 0)
|
||||
while (getline(&line_buf, &line_len, localfp) > 0) {
|
||||
if (data->nspec >= maxnspec)
|
||||
break;
|
||||
status = process_line(rec, local_path, prefix, line_buf, pass, ++lineno);
|
||||
if (status)
|
||||
goto finish;
|
||||
}
|
||||
|
||||
@ -515,10 +516,10 @@ static int init(struct selabel_handle *rec, struct selinux_opt *opts,
|
||||
status = 0;
|
||||
goto finish;
|
||||
}
|
||||
if (NULL == (data->spec_arr =
|
||||
malloc(sizeof(spec_t) * data->nspec)))
|
||||
data->spec_arr = calloc(data->nspec, sizeof(spec_t));
|
||||
if (!data->spec_arr)
|
||||
goto finish;
|
||||
memset(data->spec_arr, 0, sizeof(spec_t)*data->nspec);
|
||||
|
||||
maxnspec = data->nspec;
|
||||
rewind(fp);
|
||||
if (homedirfp)
|
||||
|
Loading…
Reference in New Issue
Block a user