Ignore EINVAL returned from fsync(2) because it is the expected error code

if we try to use it on a pipe.
This commit is contained in:
tron 2002-09-03 06:17:26 +00:00
parent 5a29cadda3
commit 4fc0806163

View File

@ -1,4 +1,4 @@
/* $NetBSD: dd.c,v 1.27 2002/09/01 11:33:22 enami Exp $ */
/* $NetBSD: dd.c,v 1.28 2002/09/03 06:17:26 tron Exp $ */
/*-
* Copyright (c) 1991, 1993, 1994
@ -47,7 +47,7 @@ __COPYRIGHT("@(#) Copyright (c) 1991, 1993, 1994\n\
#if 0
static char sccsid[] = "@(#)dd.c 8.5 (Berkeley) 4/2/94";
#else
__RCSID("$NetBSD: dd.c,v 1.27 2002/09/01 11:33:22 enami Exp $");
__RCSID("$NetBSD: dd.c,v 1.28 2002/09/03 06:17:26 tron Exp $");
#endif
#endif /* not lint */
@ -360,7 +360,7 @@ dd_close(void)
}
if (out.dbcnt)
dd_out(1);
if (out.fd == STDOUT_FILENO && fsync(out.fd) == -1)
if (out.fd == STDOUT_FILENO && fsync(out.fd) == -1 && errno != EINVAL)
err(1, "fsync stdout");
if (close(out.fd) == -1)
err(1, "close");