system: wrap console output functions
This eliminates all fmsg imports from internal/system. Signed-off-by: Ophestra <cat@gensokyo.uk>
This commit is contained in:
@@ -3,7 +3,6 @@ package system
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"git.gensokyo.uk/security/fortify/internal/fmsg"
|
||||
"git.gensokyo.uk/security/fortify/xcb"
|
||||
)
|
||||
|
||||
@@ -23,19 +22,19 @@ func (x XHost) Type() Enablement {
|
||||
return EX11
|
||||
}
|
||||
|
||||
func (x XHost) apply(_ *I) error {
|
||||
fmsg.Verbosef("inserting entry %s to X11", x)
|
||||
return fmsg.WrapErrorSuffix(xcb.ChangeHosts(xcb.HostModeInsert, xcb.FamilyServerInterpreted, "localuser\x00"+string(x)),
|
||||
func (x XHost) apply(sys *I) error {
|
||||
sys.printf("inserting entry %s to X11", x)
|
||||
return sys.wrapErrSuffix(xcb.ChangeHosts(xcb.HostModeInsert, xcb.FamilyServerInterpreted, "localuser\x00"+string(x)),
|
||||
fmt.Sprintf("cannot insert entry %s to X11:", x))
|
||||
}
|
||||
|
||||
func (x XHost) revert(_ *I, ec *Criteria) error {
|
||||
func (x XHost) revert(sys *I, ec *Criteria) error {
|
||||
if ec.hasType(x) {
|
||||
fmsg.Verbosef("deleting entry %s from X11", x)
|
||||
return fmsg.WrapErrorSuffix(xcb.ChangeHosts(xcb.HostModeDelete, xcb.FamilyServerInterpreted, "localuser\x00"+string(x)),
|
||||
sys.printf("deleting entry %s from X11", x)
|
||||
return sys.wrapErrSuffix(xcb.ChangeHosts(xcb.HostModeDelete, xcb.FamilyServerInterpreted, "localuser\x00"+string(x)),
|
||||
fmt.Sprintf("cannot delete entry %s from X11:", x))
|
||||
} else {
|
||||
fmsg.Verbosef("skipping entry %s in X11", x)
|
||||
sys.printf("skipping entry %s in X11", x)
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user