From f22537b9922cc893cede32e81a4647089834da9e Mon Sep 17 00:00:00 2001 From: Jorgen Lundman Date: Thu, 21 Nov 2024 08:00:14 +0900 Subject: [PATCH] Handle spaces in exec, and set correct default zed.d Signed-off-by: Jorgen Lundman --- cmd/zed/os/windows/zed_exec.c | 2 +- cmd/zed/zed.h | 4 ++++ include/os/windows/zfs/zfs_config.h | 4 ++-- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/cmd/zed/os/windows/zed_exec.c b/cmd/zed/os/windows/zed_exec.c index d76ace1e6fa8..b7dc48bfb47a 100644 --- a/cmd/zed/os/windows/zed_exec.c +++ b/cmd/zed/os/windows/zed_exec.c @@ -203,7 +203,7 @@ launch_process(const char *path, const char *prog, char *env[]) fflush(stderr); snprintf(cmd, sizeof (cmd), - "powershell.exe -ExecutionPolicy Bypass -File %s", path); + "powershell.exe -ExecutionPolicy Bypass -File \"%s\"", path); /* * ENV: * Unix is an array of strings, will last pointer NULL. diff --git a/cmd/zed/zed.h b/cmd/zed/zed.h index 94f13c2c9da7..ab925e7b7ad8 100644 --- a/cmd/zed/zed.h +++ b/cmd/zed/zed.h @@ -28,7 +28,11 @@ /* * Absolute path for the default zed zedlet directory. */ +#ifdef _WIN32 +#define ZED_ZEDLET_DIR SYSCONFDIR "/zed.d" +#else #define ZED_ZEDLET_DIR SYSCONFDIR "/zfs/zed.d" +#endif /* * String prefix for ZED variables passed via environment variables. diff --git a/include/os/windows/zfs/zfs_config.h b/include/os/windows/zfs/zfs_config.h index 9478b0e13c3e..533cdd234f0c 100644 --- a/include/os/windows/zfs/zfs_config.h +++ b/include/os/windows/zfs/zfs_config.h @@ -28,7 +28,7 @@ /* Define to 1 to enabled dmu tx validation */ /* #undef DEBUG_DMU_TX */ -#define SYSCONFDIR "\\SystemRoot\\System32\\drivers" // Windwosify me +#define SYSCONFDIR ZFSEXECDIR // Windwosify me #define PKGDATADIR "\\SystemRoot\\System32\\drivers" // Windwosify me #define TEXT_DOMAIN "zfs-windows-user" @@ -154,7 +154,7 @@ #define ZFSEXECDIR "C:/Program Files/OpenZFS on Windows" -#define RUNSTATEDIR ZFSEXECDIR "/zed" +#define RUNSTATEDIR ZFSEXECDIR #define _PATH_STDPATH "" #define SBINDIR ZFSEXECDIR