]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
wall: add fallback for failed sysconf()
authorKarel Zak <kzak@redhat.com>
Thu, 17 Jul 2014 13:19:34 +0000 (15:19 +0200)
committerKarel Zak <kzak@redhat.com>
Thu, 17 Jul 2014 13:19:34 +0000 (15:19 +0200)
Signed-off-by: Karel Zak <kzak@redhat.com>
term-utils/wall.c

index 80b8678d9a266820eb777a5df644bf6c3c1245ea..598e9f28c59f2ba79ffd0954f80bd28f2f6f9f38 100644 (file)
@@ -187,6 +187,9 @@ static char *makemsg(char *fname, char **mvec, int mvecsz,
        long line_max;
 
        line_max = sysconf(_SC_LINE_MAX);
+       if (line_max <= 0)
+               line_max = 512;
+
        lbuf = xmalloc(line_max);
 
        if ((fp = xfmkstemp(&tmpname, NULL)) == NULL)