]> git.ipfire.org Git - thirdparty/grub.git/commit
kern/misc: Make grub_vsnprintf() C99/POSIX conformant
authorGlenn Washburn <development@efficientek.com>
Fri, 18 Aug 2023 17:15:27 +0000 (12:15 -0500)
committerDaniel Kiper <daniel.kiper@oracle.com>
Thu, 31 Aug 2023 14:57:22 +0000 (16:57 +0200)
commit14c95e57fddb6c826bee7755232de62efc8eb45b
tree148dd512a29b6534d8a396d8fff5d65a1a8bf724
parent6d6b95720c5ef39f508693181df1e844df1c0ca0
kern/misc: Make grub_vsnprintf() C99/POSIX conformant

To comply with C99 and POSIX standards, snprintf() should return the
number of bytes that would be written to the string (excluding the
terminating NUL byte) if the buffer size was big enough. Before this
change, the return value was the minimum of the standard return and the
length of the buffer. Rarely is the return value of grub_snprintf() or
grub_vsnprintf() used with current code, and the few places where it is
used do not need to be changed.

Signed-off-by: Glenn Washburn <development@efficientek.com>
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
grub-core/kern/misc.c