From 15ba867a584a73e2810295aaa8d8540a3237579c 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 ++++ contrib/windows/OpenZFS/OpenZFS/OpenZFS.vcxproj | 6 +++++- include/os/windows/zfs/zfs_config.h | 4 ++-- 4 files changed, 12 insertions(+), 4 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/contrib/windows/OpenZFS/OpenZFS/OpenZFS.vcxproj b/contrib/windows/OpenZFS/OpenZFS/OpenZFS.vcxproj index 2490cf0924c8..865858ae6a41 100644 --- a/contrib/windows/OpenZFS/OpenZFS/OpenZFS.vcxproj +++ b/contrib/windows/OpenZFS/OpenZFS/OpenZFS.vcxproj @@ -204,7 +204,8 @@ - copy /Y "$(SolutionDir)..\..\..\out\build\x64-Debug\module\os\windows\driver\OpenZFS.man" "$(TargetDir)\OpenZFS\OpenZFS.man" + copy /Y "$(SolutionDir)..\..\..\out\build\x64-Debug\module\os\windows\driver\OpenZFS.man" "$(TargetDir)\OpenZFS\OpenZFS.man" +copy /Y "$(SolutionDir)..\..\..\out\build\x64-Debug\cmd\zed\zed.exe" "$(TargetDir)\OpenZFS\zed.exe" Copy OpenZFS.man to deploy dir - no better way? @@ -235,6 +236,9 @@ + + true + 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