Make sgetbs() return the number of characters read on success

This commit is contained in:
Andrea Mazzoleni 2026-10-03 16:50:31 +02:00
parent 97419fb67f
commit 969cb5ca31
5 changed files with 35 additions and 5 deletions

View file

@ -144,7 +144,7 @@ void test(int advise_mode)
char copy[STR_MAX];
memset(str, ' ' + j, j - 1);
str[j - 1] = 0;
if (sgetbs(s, copy, sizeof(copy)) != 0 || strcmp(copy, str) != 0) {
if (sgetbs(s, copy, sizeof(copy)) != (ssize_t)(j - 1) || strcmp(copy, str) != 0) {
/* LCOV_EXCL_START */
exit(EXIT_FAILURE);
/* LCOV_EXCL_STOP */