HomeFreeBSD

mfiutil: Handle truncation in mfi_next_learn_time

Description

mfiutil: Handle truncation in mfi_next_learn_time

Only trim the trailing newline if the output from ctime() was not
truncated. To simplify the code, use strlcpy() instead of snprintf()
since strlcpy() can't fail with a negative size (and the previous code
probably didn't handle those errors properly given the int -> size_t
conversion).

Reviewed by: imp
Differential Revision: https://reviews.freebsd.org/D50882

Details

Provenance
jhbAuthored on Jul 7 2025, 4:37 PM
Reviewer
imp
Differential Revision
D50882: mfiutil: Handle truncation in mfi_next_learn_time
Parents
rGfe1cd734a176: mfiutil: Change mfi_autolearn_(period|mode) to write to a FILE
Branches
Unknown
Tags
Unknown