On Thu, 2021-01-21 at 17:02 +0100, Omar Polo wrote:
> 
> Kevin Chadwick <m8il1i...@gmail.com> writes:
> 
> > On 1/21/21 2:58 PM, Kevin Chadwick wrote:
> > > > >    840 beep     CALL  pledge(0xc0000f4000,0xc0000ae384)
> > > > >    840 beep     STRU  promise="stdio rpath wpath cpath
> > > > > dpath tmppath inet mcast fattr chown flock unix d\
> > > > >         ns getpw sendfd recvfd tape tty proc exec
> > > > > prot_exec settime ps vminfo id pf route wroute audio v\
> > > > >         ideo bpf unveil error"
> > > > >    840 beep     STRU  execpromise=""
> > > > >    840 beep     RET   pledge 0
> > > > > 
> > > > Whatever you are trying to do is ridiculous.
> > > Absolutely. In fact the program itself is pointless to
> > > pledge, playing a beep to
> > > the speaker. However, I had pledge disabled in my binaries
> > > due to the syscall 74
> > > Go bug that was fixed. This is just testing with the most
> > > permissable settings.
> > > Perhaps that in itself could cause an issue.
> > 
> > Is execpromise="" equivalent to passing null in c as a nil
> > string in Go is
> > initialised to "" (function sig = string)
> > 
> > Perhaps I should ktrace the whacky full promise passsed as
> > execpromise too?
> 
> Sorry if I chime in, but execpromise="" is a whole different
> story from
> execpromise=NULL.
> 
> > A promises value of "" restricts the process to the _exit(2)
> > system
> > call.
> 
> "" is a pointer to a string whose first character is NUL (\0),
> NULL is
> the null pointer.
> 
> I don't know how to convince the go type system to discern
> between nil
> and "", maybe you need something like sql.NullString
> 
> HTH
> 
> Omar Polo
> 

In Go, if you have a function that takes an argument of type
`string`, then it can't accept nil. In cases where "no string at
all" needs to be distinguished from "empty string", then I would
use `*string` as an argument type.

This makes me think this pledge function needs to take a `*string`
instead of just `string`.

--Aaron

Reply via email to