mirror of
https://github.com/roddhjav/apparmor.d.git
synced 2025-01-30 23:05:11 +01:00
chore: minor cosmetic.
This commit is contained in:
parent
cad0b936e5
commit
6810fe679e
1 changed files with 6 additions and 5 deletions
|
@ -182,7 +182,8 @@ func (p *AppArmorProfile) MergeRules() {
|
||||||
// Format the profile for better readability before printing it
|
// Format the profile for better readability before printing it
|
||||||
// Follow: https://apparmor.pujol.io/development/guidelines/#the-file-block
|
// Follow: https://apparmor.pujol.io/development/guidelines/#the-file-block
|
||||||
func (p *AppArmorProfile) Format() {
|
func (p *AppArmorProfile) Format() {
|
||||||
hasOwnedRule := false
|
const prefixOwner = " "
|
||||||
|
hasOwnerRule := false
|
||||||
for i := len(p.Rules) - 1; i > 0; i-- {
|
for i := len(p.Rules) - 1; i > 0; i-- {
|
||||||
j := i - 1
|
j := i - 1
|
||||||
typeOfI := reflect.TypeOf(p.Rules[i])
|
typeOfI := reflect.TypeOf(p.Rules[i])
|
||||||
|
@ -195,14 +196,14 @@ func (p *AppArmorProfile) Format() {
|
||||||
|
|
||||||
// Add prefix before rule path to align with other rule
|
// Add prefix before rule path to align with other rule
|
||||||
if p.Rules[i].(*File).Owner {
|
if p.Rules[i].(*File).Owner {
|
||||||
hasOwnedRule = true
|
hasOwnerRule = true
|
||||||
} else if hasOwnedRule {
|
} else if hasOwnerRule {
|
||||||
p.Rules[i].(*File).Prefix = " "
|
p.Rules[i].(*File).Prefix = prefixOwner
|
||||||
}
|
}
|
||||||
|
|
||||||
if letterI != letterJ {
|
if letterI != letterJ {
|
||||||
// Add a new empty line between Files rule of different type
|
// Add a new empty line between Files rule of different type
|
||||||
hasOwnedRule = false
|
hasOwnerRule = false
|
||||||
p.Rules = append(p.Rules[:i], append([]ApparmorRule{&Rule{}}, p.Rules[i:]...)...)
|
p.Rules = append(p.Rules[:i], append([]ApparmorRule{&Rule{}}, p.Rules[i:]...)...)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue