From d031c820ff8beb39bcdf05daebb5dee897ad29dc Mon Sep 17 00:00:00 2001 From: Ophestra Umiker Date: Sun, 27 Oct 2024 23:49:37 +0900 Subject: [PATCH] shim: expose checkPid in constructor This will be supported soon when launching via fsu. Signed-off-by: Ophestra Umiker --- internal/app/start.go | 5 ++++- internal/shim/parent.go | 6 ++---- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/internal/app/start.go b/internal/app/start.go index ea21601..bac3f12 100644 --- a/internal/app/start.go +++ b/internal/app/start.go @@ -61,6 +61,9 @@ func (a *app) Start() error { Verbose: fmsg.Verbose(), }, + // checkPid is impossible at the moment since there is no reliable way to obtain shim's pid + // this feature is disabled here until sudo is replaced by fortify suid wrapper + false, ) // startup will go ahead, commit system setup @@ -105,7 +108,7 @@ type StateStoreError struct { } func (e *StateStoreError) equiv(a ...any) error { - if e.Inner == true && e.DoErr == nil && e.InnerErr == nil && e.Err == nil { + if e.Inner && e.DoErr == nil && e.InnerErr == nil && e.Err == nil { return nil } else { return fmsg.WrapErrorSuffix(e, a...) diff --git a/internal/shim/parent.go b/internal/shim/parent.go index 2ac9d6a..e069667 100644 --- a/internal/shim/parent.go +++ b/internal/shim/parent.go @@ -37,10 +37,8 @@ type Shim struct { payload *Payload } -func New(executable string, uid uint32, socket string, wl *Wayland, payload *Payload) *Shim { - // checkPid is impossible at the moment since there is no way to obtain shim's pid - // this feature is disabled here until sudo is replaced by fortify suid wrapper - return &Shim{uid: uid, executable: executable, socket: socket, wl: wl, payload: payload} +func New(executable string, uid uint32, socket string, wl *Wayland, payload *Payload, checkPid bool) *Shim { + return &Shim{uid: uid, executable: executable, socket: socket, wl: wl, payload: payload, checkPid: checkPid} } func (s *Shim) String() string {