From 9647eb6a6b5607e9aac1e2c113e80f2e966ec0ac Mon Sep 17 00:00:00 2001 From: Ophestra Umiker Date: Mon, 7 Oct 2024 12:48:20 +0900 Subject: helper: separate pipes from Helper Upcoming bwrap helper implementation requires two sets of pipes to be managed, fd will also no longer be constant. Signed-off-by: Ophestra Umiker --- helper/args.go | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'helper/args.go') diff --git a/helper/args.go b/helper/args.go index b06cc2ee..c841fd36 100644 --- a/helper/args.go +++ b/helper/args.go @@ -10,11 +10,11 @@ var ( ErrContainsNull = errors.New("argument contains null character") ) -type argsFD []string +type argsWt []string // checks whether any element contains the null character // must be called before args use and args must not be modified after call -func (a argsFD) check() error { +func (a argsWt) check() error { for _, arg := range a { for _, b := range arg { if b == '\x00' { @@ -26,7 +26,7 @@ func (a argsFD) check() error { return nil } -func (a argsFD) WriteTo(w io.Writer) (int64, error) { +func (a argsWt) WriteTo(w io.Writer) (int64, error) { // assuming already checked nt := 0 @@ -43,13 +43,13 @@ func (a argsFD) WriteTo(w io.Writer) (int64, error) { return int64(nt), nil } -func (a argsFD) String() string { +func (a argsWt) String() string { return strings.Join(a, " ") } // NewCheckedArgs returns a checked argument writer for args. // Callers must not retain any references to args. func NewCheckedArgs(args []string) (io.WriterTo, error) { - a := argsFD(args) + a := argsWt(args) return a, a.check() } -- cgit v1.3.1