flush stdout before switching output to stderr.

This commit is contained in:
yamt 2004-10-25 20:35:40 +00:00
parent a2e8d4b465
commit d9a63ae94a
1 changed files with 3 additions and 1 deletions

View File

@ -1,4 +1,4 @@
/* $Id: getdents.c,v 1.4 2004/10/25 20:34:50 yamt Exp $ */ /* $Id: getdents.c,v 1.5 2004/10/25 20:35:40 yamt Exp $ */
/*- /*-
* Copyright (c)2004 YAMAMOTO Takashi, * Copyright (c)2004 YAMAMOTO Takashi,
@ -152,11 +152,13 @@ main(int argc, char *argv[])
if (ret == -1) if (ret == -1)
err(EXIT_FAILURE, "getdents"); err(EXIT_FAILURE, "getdents");
if (p->sz != ret) { if (p->sz != ret) {
fflush(NULL);
fprintf(stderr, "off=%" PRIx64 fprintf(stderr, "off=%" PRIx64
": different sz %d != %d\n", ": different sz %d != %d\n",
(uint64_t)off, p->sz, ret); (uint64_t)off, p->sz, ret);
differ = 1; differ = 1;
} else if (memcmp(p->buf, buf, (size_t)ret)) { } else if (memcmp(p->buf, buf, (size_t)ret)) {
fflush(NULL);
fprintf(stderr, "off=%" PRIx64 ": different data\n", fprintf(stderr, "off=%" PRIx64 ": different data\n",
(uint64_t)off); (uint64_t)off);
fprintf(stderr, "previous:\n"); fprintf(stderr, "previous:\n");