diff -u -r samba-4.18.2/source3/modules/vfs_default.c samba-4.18.2-new/source3/modules/vfs_default.c --- samba-4.18.2/source3/modules/vfs_default.c 2023-01-18 16:32:24.198553300 +0100 +++ samba-4.18.2-new/source3/modules/vfs_default.c 2023-05-29 16:31:54.359488000 +0200 @@ -729,7 +729,7 @@ SMB_ASSERT(!is_named_stream(smb_fname)); -#ifdef O_PATH +#if defined(O_PATH) && defined(LINUX) have_opath = true; if (fsp->fsp_flags.is_pathref) { flags |= O_PATH; diff -u -r samba-4.18.2/source3/smbd/files.c samba-4.18.2-new/source3/smbd/files.c --- samba-4.18.2/source3/smbd/files.c 2023-01-18 16:32:24.242553500 +0100 +++ samba-4.18.2-new/source3/smbd/files.c 2023-05-29 16:22:00.977261000 +0200 @@ -770,7 +770,7 @@ } fsp->fsp_name = &full_fname; -#ifdef O_PATH +#if defined(O_PATH) && defined(LINUX) /* * Add O_PATH manually, doing this by setting * fsp->fsp_flags.is_pathref will make us become_root() in the