[Topic DIscussion] 升级到20.2后我的Golang项目编译就失败了
Tofloor
poster avatar
markus777
deepin
2021-04-08 21:05
Author
const (
	_LINUX_CAPABILITY_VERSION_3 = 0x20080522
	_LINUX_CAPABILITY_U32S_3    = 2
)
func SetCap(capData UserCapDataStruct) error {
	a := &userCapHeaderStruct{
		_LINUX_CAPABILITY_VERSION_3,
		0,
	}
	b := &capData
	_, _, err := syscall.RawSyscall(syscall.SYS_CAPSET,
		uintptr(unsafe.Pointer(a)),
		uintptr(unsafe.Pointer(b)), 0)
	if 0 != err {
		return err
	}
	return nil
}

      这是之前项目里遗留的代码,在运行syscall.RawSyscall时错误信息是operation not permitted,感觉是因为20.2升级了系统内核导致的。

搜了一圈说是加sudu与运行给权限之类的也还是不行,论坛有大佬能支支招吗

Reply Favorite View the author
All Replies
lcw0268
deepin
2021-04-08 21:36
#1

楼主细心些,看看自己输入有没有错误:

sudo 都能输入错,我服你了。

Reply View the author
shun4578
deepin
2021-04-09 04:04
#2

sudo 输入有错误

Reply View the author