From ca03adf5260bf4681c3299659488ec20e5366257 Mon Sep 17 00:00:00 2001 From: Federico Di Pierro Date: Tue, 28 Nov 2023 11:03:39 +0100 Subject: [PATCH] fix(cmd/driver,pkg/driver): avoid using `filepath.Join` when joining hostRoot. Signed-off-by: Federico Di Pierro --- cmd/driver/config/config.go | 2 +- pkg/driver/distro/distro.go | 2 +- pkg/driver/distro/distro_test.go | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/cmd/driver/config/config.go b/cmd/driver/config/config.go index 3990e61ad..6f6f8599c 100644 --- a/cmd/driver/config/config.go +++ b/cmd/driver/config/config.go @@ -190,7 +190,7 @@ func checkFalcoRunsWithDrivers(engineKind string) error { } func (o *driverConfigOptions) replaceDriverTypeInFalcoConfig(hostRoot string, driverType drivertype.DriverType) error { - falcoCfgFile := filepath.Join(hostRoot, "etc", "falco", "falco.yaml") + falcoCfgFile := hostRoot + "/etc/falco/falco.yaml" type engineCfg struct { Kind string `yaml:"kind"` } diff --git a/pkg/driver/distro/distro.go b/pkg/driver/distro/distro.go index 8d00056cb..7e47ee081 100644 --- a/pkg/driver/distro/distro.go +++ b/pkg/driver/distro/distro.go @@ -265,7 +265,7 @@ func getKernelConfig(printer *output.Printer, kr *kernelrelease.KernelRelease, h func downloadKernelSrc(ctx context.Context, printer *output.Printer, kr *kernelrelease.KernelRelease, - url string, hostRoot string, + url, hostRoot string, stripComponents int, ) (map[string]string, error) { env := make(map[string]string) diff --git a/pkg/driver/distro/distro_test.go b/pkg/driver/distro/distro_test.go index 08b7e4cb4..1132d1529 100644 --- a/pkg/driver/distro/distro_test.go +++ b/pkg/driver/distro/distro_test.go @@ -28,7 +28,7 @@ import ( func TestDiscoverDistro(t *testing.T) { hostRoot := "." - etcDir := filepath.Join(hostRoot, "etc") + etcDir := hostRoot + "/etc" osReleaseFile := filepath.Join(etcDir, "os-release") type osID struct {