fix(aa): ineffective assignment
This commit is contained in:
parent
ff5ff965cd
commit
228d3b653c
12 changed files with 39 additions and 20 deletions
|
|
@ -26,7 +26,8 @@ func (r *All) Compare(other Rule) int {
|
||||||
|
|
||||||
func (r *All) Merge(other Rule) bool {
|
func (r *All) Merge(other Rule) bool {
|
||||||
o, _ := other.(*All)
|
o, _ := other.(*All)
|
||||||
return r.RuleBase.merge(o.RuleBase)
|
b := &r.RuleBase
|
||||||
|
return b.merge(o.RuleBase)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (r *All) String() string {
|
func (r *All) String() string {
|
||||||
|
|
|
||||||
|
|
@ -83,8 +83,10 @@ func (r RuleBase) Merge(other Rule) bool {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
func (r RuleBase) merge(other RuleBase) bool {
|
func (r *RuleBase) merge(other RuleBase) bool {
|
||||||
|
if other.Comment != "" {
|
||||||
r.Comment += " " + other.Comment
|
r.Comment += " " + other.Comment
|
||||||
|
}
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -120,7 +120,8 @@ func (r *Dbus) Merge(other Rule) bool {
|
||||||
r.Interface == o.Interface && r.Member == o.Member &&
|
r.Interface == o.Interface && r.Member == o.Member &&
|
||||||
r.PeerName == o.PeerName && r.PeerLabel == o.PeerLabel {
|
r.PeerName == o.PeerName && r.PeerLabel == o.PeerLabel {
|
||||||
r.Access = merge(r.Kind(), "access", r.Access, o.Access)
|
r.Access = merge(r.Kind(), "access", r.Access, o.Access)
|
||||||
return r.RuleBase.merge(o.RuleBase)
|
b := &r.RuleBase
|
||||||
|
return b.merge(o.RuleBase)
|
||||||
}
|
}
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -138,7 +138,8 @@ func (r *File) Merge(other Rule) bool {
|
||||||
}
|
}
|
||||||
if r.Owner == o.Owner && r.Path == o.Path && r.Target == o.Target {
|
if r.Owner == o.Owner && r.Path == o.Path && r.Target == o.Target {
|
||||||
r.Access = merge(r.Kind(), "access", r.Access, o.Access)
|
r.Access = merge(r.Kind(), "access", r.Access, o.Access)
|
||||||
return r.RuleBase.merge(o.RuleBase)
|
b := &r.RuleBase
|
||||||
|
return b.merge(o.RuleBase)
|
||||||
}
|
}
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -71,7 +71,8 @@ func (r *IOUring) Merge(other Rule) bool {
|
||||||
}
|
}
|
||||||
if r.Label == o.Label {
|
if r.Label == o.Label {
|
||||||
r.Access = merge(r.Kind(), "access", r.Access, o.Access)
|
r.Access = merge(r.Kind(), "access", r.Access, o.Access)
|
||||||
return r.RuleBase.merge(o.RuleBase)
|
b := &r.RuleBase
|
||||||
|
return b.merge(o.RuleBase)
|
||||||
}
|
}
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -65,7 +65,7 @@ func (m MountConditions) Compare(other MountConditions) int {
|
||||||
return compare(m.Options, other.Options)
|
return compare(m.Options, other.Options)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (m MountConditions) Merge(other MountConditions) bool {
|
func (m *MountConditions) Merge(other MountConditions) bool {
|
||||||
if m.FsType == other.FsType {
|
if m.FsType == other.FsType {
|
||||||
m.Options = merge(MOUNT, "flags", m.Options, other.Options)
|
m.Options = merge(MOUNT, "flags", m.Options, other.Options)
|
||||||
return true
|
return true
|
||||||
|
|
@ -143,13 +143,15 @@ func (r *Mount) Compare(other Rule) int {
|
||||||
|
|
||||||
func (r *Mount) Merge(other Rule) bool {
|
func (r *Mount) Merge(other Rule) bool {
|
||||||
o, _ := other.(*Mount)
|
o, _ := other.(*Mount)
|
||||||
|
mc := &r.MountConditions
|
||||||
|
|
||||||
if !r.Qualifier.Equal(o.Qualifier) {
|
if !r.Qualifier.Equal(o.Qualifier) {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
if r.Source == o.Source && r.MountPoint == o.MountPoint &&
|
if r.Source == o.Source && r.MountPoint == o.MountPoint &&
|
||||||
r.MountConditions.Merge(o.MountConditions) {
|
mc.Merge(o.MountConditions) {
|
||||||
return r.RuleBase.merge(o.RuleBase)
|
b := &r.RuleBase
|
||||||
|
return b.merge(o.RuleBase)
|
||||||
}
|
}
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
@ -220,12 +222,14 @@ func (r *Umount) Compare(other Rule) int {
|
||||||
|
|
||||||
func (r *Umount) Merge(other Rule) bool {
|
func (r *Umount) Merge(other Rule) bool {
|
||||||
o, _ := other.(*Umount)
|
o, _ := other.(*Umount)
|
||||||
|
mc := &r.MountConditions
|
||||||
|
|
||||||
if !r.Qualifier.Equal(o.Qualifier) {
|
if !r.Qualifier.Equal(o.Qualifier) {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
if r.MountPoint == o.MountPoint && r.MountConditions.Merge(o.MountConditions) {
|
if r.MountPoint == o.MountPoint && mc.Merge(o.MountConditions) {
|
||||||
return r.RuleBase.merge(o.RuleBase)
|
b := &r.RuleBase
|
||||||
|
return b.merge(o.RuleBase)
|
||||||
}
|
}
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
@ -297,12 +301,14 @@ func (r *Remount) Compare(other Rule) int {
|
||||||
|
|
||||||
func (r *Remount) Merge(other Rule) bool {
|
func (r *Remount) Merge(other Rule) bool {
|
||||||
o, _ := other.(*Remount)
|
o, _ := other.(*Remount)
|
||||||
|
mc := &r.MountConditions
|
||||||
|
|
||||||
if !r.Qualifier.Equal(o.Qualifier) {
|
if !r.Qualifier.Equal(o.Qualifier) {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
if r.MountPoint == o.MountPoint && r.MountConditions.Merge(o.MountConditions) {
|
if r.MountPoint == o.MountPoint && mc.Merge(o.MountConditions) {
|
||||||
return r.RuleBase.merge(o.RuleBase)
|
b := &r.RuleBase
|
||||||
|
return b.merge(o.RuleBase)
|
||||||
}
|
}
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -105,7 +105,8 @@ func (r *Mqueue) Merge(other Rule) bool {
|
||||||
}
|
}
|
||||||
if r.Type == o.Type && r.Label == o.Label && r.Name == o.Name {
|
if r.Type == o.Type && r.Label == o.Label && r.Name == o.Name {
|
||||||
r.Access = merge(r.Kind(), "access", r.Access, o.Access)
|
r.Access = merge(r.Kind(), "access", r.Access, o.Access)
|
||||||
return r.RuleBase.merge(o.RuleBase)
|
b := &r.RuleBase
|
||||||
|
return b.merge(o.RuleBase)
|
||||||
}
|
}
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -261,7 +261,8 @@ func (r *Variable) Merge(other Rule) bool {
|
||||||
|
|
||||||
if r.Name == o.Name && r.Define == o.Define {
|
if r.Name == o.Name && r.Define == o.Define {
|
||||||
r.Values = merge(r.Kind(), "access", r.Values, o.Values)
|
r.Values = merge(r.Kind(), "access", r.Values, o.Values)
|
||||||
return r.RuleBase.merge(o.RuleBase)
|
b := &r.RuleBase
|
||||||
|
return b.merge(o.RuleBase)
|
||||||
}
|
}
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -62,7 +62,8 @@ func (r *Ptrace) Merge(other Rule) bool {
|
||||||
}
|
}
|
||||||
if r.Peer == o.Peer {
|
if r.Peer == o.Peer {
|
||||||
r.Access = merge(r.Kind(), "access", r.Access, o.Access)
|
r.Access = merge(r.Kind(), "access", r.Access, o.Access)
|
||||||
return r.RuleBase.merge(o.RuleBase)
|
b := &r.RuleBase
|
||||||
|
return b.merge(o.RuleBase)
|
||||||
}
|
}
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -86,10 +86,12 @@ func (r *Signal) Merge(other Rule) bool {
|
||||||
switch {
|
switch {
|
||||||
case r.Peer == o.Peer && compare(r.Set, o.Set) == 0:
|
case r.Peer == o.Peer && compare(r.Set, o.Set) == 0:
|
||||||
r.Access = merge(r.Kind(), "access", r.Access, o.Access)
|
r.Access = merge(r.Kind(), "access", r.Access, o.Access)
|
||||||
return r.RuleBase.merge(o.RuleBase)
|
b := &r.RuleBase
|
||||||
|
return b.merge(o.RuleBase)
|
||||||
case r.Peer == o.Peer && compare(r.Access, o.Access) == 0:
|
case r.Peer == o.Peer && compare(r.Access, o.Access) == 0:
|
||||||
r.Set = merge(r.Kind(), "set", r.Set, o.Set)
|
r.Set = merge(r.Kind(), "set", r.Set, o.Set)
|
||||||
return r.RuleBase.merge(o.RuleBase)
|
b := &r.RuleBase
|
||||||
|
return b.merge(o.RuleBase)
|
||||||
}
|
}
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -119,7 +119,8 @@ func (r *Unix) Merge(other Rule) bool {
|
||||||
r.Label == o.Label && r.Attr == o.Attr && r.Opt == o.Opt &&
|
r.Label == o.Label && r.Attr == o.Attr && r.Opt == o.Opt &&
|
||||||
r.PeerLabel == o.PeerLabel && r.PeerAddr == o.PeerAddr {
|
r.PeerLabel == o.PeerLabel && r.PeerAddr == o.PeerAddr {
|
||||||
r.Access = merge(r.Kind(), "access", r.Access, o.Access)
|
r.Access = merge(r.Kind(), "access", r.Access, o.Access)
|
||||||
return r.RuleBase.merge(o.RuleBase)
|
b := &r.RuleBase
|
||||||
|
return b.merge(o.RuleBase)
|
||||||
}
|
}
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -56,7 +56,8 @@ func (r *Userns) Compare(other Rule) int {
|
||||||
|
|
||||||
func (r *Userns) Merge(other Rule) bool {
|
func (r *Userns) Merge(other Rule) bool {
|
||||||
o, _ := other.(*Userns)
|
o, _ := other.(*Userns)
|
||||||
return r.RuleBase.merge(o.RuleBase)
|
b := &r.RuleBase
|
||||||
|
return b.merge(o.RuleBase)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (r *Userns) String() string {
|
func (r *Userns) String() string {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue