Skip to content

Commit

Permalink
FreeBSD: Fix regression from kmem_scnprintf() in libzfs
Browse files Browse the repository at this point in the history
kmem_scnprintf() is only available in libzpool. Recent buildbot issues
with showing FreeBSD results kept us from seeing this before
97143b9 was merged.

The code has been changed to sanitize the output from `kmem_scnprintf()`.

Reviewed-by: Allan Jude <allan@klarasystems.com>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Richard Yao <richard.yao@alumni.stonybrook.edu>
Closes #14111
  • Loading branch information
ryao authored Nov 1, 2022
1 parent fdc59cf commit da3d266
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion lib/libzfs/os/freebsd/libzfs_compat.c
Original file line number Diff line number Diff line change
Expand Up @@ -202,8 +202,10 @@ libzfs_error_init(int error)
size_t msglen = sizeof (errbuf);

if (modfind("zfs") < 0) {
size_t len = kmem_scnprintf(msg, msglen, dgettext(TEXT_DOMAIN,
size_t len = snprintf(msg, msglen, dgettext(TEXT_DOMAIN,
"Failed to load %s module: "), ZFS_KMOD);
if (len >= msglen)
len = msglen - 1;
msg += len;
msglen -= len;
}
Expand Down

0 comments on commit da3d266

Please sign in to comment.