]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
pg: fix wcstombs() use
authorKarel Zak <kzak@redhat.com>
Tue, 1 Sep 2020 09:50:11 +0000 (11:50 +0200)
committerKarel Zak <kzak@redhat.com>
Tue, 1 Sep 2020 09:54:07 +0000 (11:54 +0200)
The size (3rd) argument should be ignored if the 1st *dest is NULL, but it seems gcc & glibc headers
are more pedantic now:

ext-utils/pg.c:456:13: error: argument 1 is null but the corresponding size argument 3 value is 2048 [-Werror=nonnull]

Signed-off-by: Karel Zak <kzak@redhat.com>
text-utils/pg.c

index 5d01ebff34f1389ff0716e69b6034842fd02bfa1..fba77007184b8224e435513be539ebb3282db1a3 100644 (file)
@@ -453,7 +453,7 @@ static char *endline_for_mb(unsigned col, char *s)
  ended:
        *end = L'\0';
        p = wbuf;
-       if ((pos = wcstombs(NULL, p, READBUF)) == (size_t)-1)
+       if ((pos = wcstombs(NULL, p, 0)) == (size_t)-1)
                return s + 1;
        return s + pos;
 }