build: improve error message in the stack direcive.

This commit is contained in:
Alexandre Pujol 2025-05-26 00:55:48 +02:00
parent e83a9a60dc
commit d9430c68c1
No known key found for this signature in database
GPG key ID: C5469996F0DF68EC

View file

@ -55,7 +55,10 @@ func (s Stack) Apply(opt *Option, profile string) (string, error) {
res := ""
for name := range opt.ArgMap {
stackedProfile := prebuild.RootApparmord.Join(name).MustReadFileAsString()
stackedProfile, err := prebuild.RootApparmord.Join(name).ReadFileAsString()
if err != nil {
return "", fmt.Errorf("%s need to stack: %w", name, err)
}
m := regRules.FindStringSubmatch(stackedProfile)
if len(m) < 2 {
return "", fmt.Errorf("no profile found in %s", name)