Merge branch 'jc/genzeros-avoid-raw-write'

A test helper had a single write(2) of 256kB, which was too big for
some platforms (e.g. NonStop), which has been corrected by using
xwrite() wrapper appropriately.

* jc/genzeros-avoid-raw-write:
  test-genzeros: avoid raw write(2)
This commit is contained in:
Junio C Hamano 2023-02-24 11:32:30 -08:00
commit deb32d6d60

View File

@ -17,15 +17,16 @@ int cmd__genzeros(int argc, const char **argv)
/* Writing out individual NUL bytes is slow... */
while (count < 0)
if (write(1, zeros, ARRAY_SIZE(zeros)) < 0)
return -1;
if (xwrite(1, zeros, ARRAY_SIZE(zeros)) < 0)
die_errno("write error");
while (count > 0) {
n = write(1, zeros, count < ARRAY_SIZE(zeros) ?
count : ARRAY_SIZE(zeros));
n = xwrite(1, zeros,
count < ARRAY_SIZE(zeros)
? count : ARRAY_SIZE(zeros));
if (n < 0)
return -1;
die_errno("write error");
count -= n;
}