Skip to content

Commit

Permalink
Handle spaces in exec, and set correct default zed.d
Browse files Browse the repository at this point in the history
Signed-off-by: Jorgen Lundman <[email protected]>
  • Loading branch information
lundman committed Nov 20, 2024
1 parent 65ae459 commit 15ba867
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 4 deletions.
2 changes: 1 addition & 1 deletion cmd/zed/os/windows/zed_exec.c
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
4 changes: 4 additions & 0 deletions cmd/zed/zed.h
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
6 changes: 5 additions & 1 deletion contrib/windows/OpenZFS/OpenZFS/OpenZFS.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,8 @@
</Command>
</PostBuildEvent>
<PreLinkEvent>
<Command>copy /Y "$(SolutionDir)..\..\..\out\build\x64-Debug\module\os\windows\driver\OpenZFS.man" "$(TargetDir)\OpenZFS\OpenZFS.man"</Command>
<Command>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"</Command>
<Message>Copy OpenZFS.man to deploy dir - no better way?</Message>
</PreLinkEvent>
<PreBuildEvent>
Expand Down Expand Up @@ -235,6 +236,9 @@
</ItemGroup>
<ItemGroup>
<Inf Include="..\..\..\..\module\os\windows\OpenZFS.inf" />
<Inf Include="..\..\..\..\module\os\windows\zed.inf">
<SpecifyArchitecture Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</SpecifyArchitecture>
</Inf>
</ItemGroup>
<ItemGroup>
<ClCompile Include="..\..\..\..\module\os\windows\debug.c" />
Expand Down
4 changes: 2 additions & 2 deletions include/os/windows/zfs/zfs_config.h
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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

0 comments on commit 15ba867

Please sign in to comment.