feat: allow hardlinks in the system extension images

They should cause no harm as every extension as an image on its own, so
hardlinks are only available between the files in one image only.

Signed-off-by: Andrey Smirnov <andrey.smirnov@talos-systems.com>
This commit is contained in:
Andrey Smirnov 2022-03-21 15:38:34 +03:00
parent 1e982808fb
commit 58cb9db1e2
No known key found for this signature in database
GPG Key ID: 7B26396447AB6DFD

View File

@ -10,7 +10,6 @@ import (
"os"
"path/filepath"
"strings"
"syscall"
hashiversion "github.com/hashicorp/go-version"
@ -70,18 +69,6 @@ func (ext *Extension) validateContents() error {
return fmt.Errorf("world-writeable files are not allowed: %q", itemPath)
}
var st fs.FileInfo
st, err = d.Info()
if err != nil {
return err
}
// no hardlinks
if !d.IsDir() && st.Sys().(*syscall.Stat_t).Nlink > 1 {
return fmt.Errorf("hardlinks are not allowed: %q", itemPath)
}
// no special files
if !d.IsDir() && !d.Type().IsRegular() && d.Type().Type() != os.ModeSymlink {
return fmt.Errorf("special files are not allowed: %q", itemPath)