From 48cf7d674aa75b9ba96d83d1f6a61708d1758ab0 Mon Sep 17 00:00:00 2001 From: Ryan Moeller Date: Fri, 30 Oct 2020 18:19:02 -0400 Subject: [PATCH] FreeBSD: Fix 12.2-STABLE after AT_BENEATH MFC AT_BENEATH was merged to stable/12, where kern_unlinkat takes a non-const path. DECONST the path passed to kern_unlinkat in the case where AT_BENEATH is defined. Reviewed-by: Brian Behlendorf Signed-off-by: Ryan Moeller Closes #11139 --- module/os/freebsd/zfs/zfs_file_os.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/module/os/freebsd/zfs/zfs_file_os.c b/module/os/freebsd/zfs/zfs_file_os.c index d7786d5136a2..d86eeceab754 100644 --- a/module/os/freebsd/zfs/zfs_file_os.c +++ b/module/os/freebsd/zfs/zfs_file_os.c @@ -296,7 +296,8 @@ zfs_file_unlink(const char *fnamep) rc = kern_funlinkat(curthread, AT_FDCWD, fnamep, FD_NONE, seg, 0, 0); #else #ifdef AT_BENEATH - rc = kern_unlinkat(curthread, AT_FDCWD, fnamep, seg, 0, 0); + rc = kern_unlinkat(curthread, AT_FDCWD, __DECONST(char *, fnamep), + seg, 0, 0); #else rc = kern_unlinkat(curthread, AT_FDCWD, __DECONST(char *, fnamep), seg, 0);