]> granicus.if.org Git - postgresql/commitdiff
Fix compiler warning
authorPeter Eisentraut <peter_e@gmx.net>
Wed, 20 Sep 2017 13:03:04 +0000 (09:03 -0400)
committerPeter Eisentraut <peter_e@gmx.net>
Wed, 20 Sep 2017 13:03:04 +0000 (09:03 -0400)
from gcc-7 -Wformat-truncation (via -Wall)

src/bin/initdb/initdb.c

index 1d4a138618bbc73c2b83e9519c9e02c161fc36b1..27fcf5a87f742a44bc35a01c6ac7d66ef418af7b 100644 (file)
@@ -1009,12 +1009,12 @@ static char *
 pretty_wal_size(int segment_count)
 {
        int                     sz = wal_segment_size_mb * segment_count;
-       char       *result = pg_malloc(10);
+       char       *result = pg_malloc(11);
 
        if ((sz % 1024) == 0)
-               snprintf(result, 10, "%dGB", sz / 1024);
+               snprintf(result, 11, "%dGB", sz / 1024);
        else
-               snprintf(result, 10, "%dMB", sz);
+               snprintf(result, 11, "%dMB", sz);
 
        return result;
 }