Skip to content

Commit deb32d6

Browse files
committed
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)
2 parents a7981d0 + 58eab6f commit deb32d6

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

t/helper/test-genzeros.c

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,15 +17,16 @@ int cmd__genzeros(int argc, const char **argv)
1717

1818
/* Writing out individual NUL bytes is slow... */
1919
while (count < 0)
20-
if (write(1, zeros, ARRAY_SIZE(zeros)) < 0)
21-
return -1;
20+
if (xwrite(1, zeros, ARRAY_SIZE(zeros)) < 0)
21+
die_errno("write error");
2222

2323
while (count > 0) {
24-
n = write(1, zeros, count < ARRAY_SIZE(zeros) ?
25-
count : ARRAY_SIZE(zeros));
24+
n = xwrite(1, zeros,
25+
count < ARRAY_SIZE(zeros)
26+
? count : ARRAY_SIZE(zeros));
2627

2728
if (n < 0)
28-
return -1;
29+
die_errno("write error");
2930

3031
count -= n;
3132
}

0 commit comments

Comments
 (0)