syscall: forkExec - todo

This commit is contained in:
xushiwei
2024-07-18 15:58:44 +08:00
parent f2dafa7544
commit daf0a9dc9a
7 changed files with 61 additions and 369 deletions

View File

@@ -14,6 +14,7 @@ import (
"github.com/goplus/llgo/c"
"github.com/goplus/llgo/c/os"
"github.com/goplus/llgo/c/syscall"
)
var (
@@ -116,18 +117,18 @@ func Getenv(key string) (value string, found bool) {
func Setenv(key, value string) error {
envOnce.Do(copyenv)
if len(key) == 0 {
return EINVAL
return Errno(syscall.EINVAL)
}
for i := 0; i < len(key); i++ {
if key[i] == '=' || key[i] == 0 {
return EINVAL
return Errno(syscall.EINVAL)
}
}
// On Plan 9, null is used as a separator, eg in $path.
if runtime.GOOS != "plan9" {
for i := 0; i < len(value); i++ {
if value[i] == 0 {
return EINVAL
return Errno(syscall.EINVAL)
}
}
}