From 1b13ee113b1b616d2a1cb0361d228639aff4a5c9 Mon Sep 17 00:00:00 2001 From: Aki Tuomi Date: Thu, 21 Feb 2019 18:50:10 +0200 Subject: [PATCH] lib-program-client: test-program-client-local - Use dd instead of head `head -c n` is only guaranteed to print n bytes, but it may consume more. FreeBSD's implementation of head(1) uses buffered stdio, which did just that. `dd` consumes exactly the specified number of bytes. --- src/lib-program-client/test-program-client-local.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/lib-program-client/test-program-client-local.c b/src/lib-program-client/test-program-client-local.c index 03e24015cd..2040b15581 100644 --- a/src/lib-program-client/test-program-client-local.c +++ b/src/lib-program-client/test-program-client-local.c @@ -178,12 +178,12 @@ static void test_program_io_big(void) and then finally reads the rest in one go. */ const char *const args[] = { "-c", - "(head -c 10240; sleep 0.1; " - "head -c 10240; sleep 0.1; " - "head -c 10240; sleep 0.1; " - "head -c 10240; sleep 0.1; " - "head -c 10240; sleep 0.1; " - "head -c 10240; sleep 0.1; cat)", + "(dd bs=10240 count=1; sleep 0.1; " + "dd bs=10240 count=1; sleep 0.1; " + "dd bs=10240 count=1; sleep 0.1; " + "dd bs=10240 count=1; sleep 0.1; " + "dd bs=10240 count=1; sleep 0.1; " + "dd bs=10240 count=1; sleep 0.1; cat) 2>/dev/null", NULL }; -- 2.47.3