diff options
Diffstat (limited to 'lib/isc/unix/stdio.c')
-rw-r--r-- | lib/isc/unix/stdio.c | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/lib/isc/unix/stdio.c b/lib/isc/unix/stdio.c index 4e294dbc2fee..360c8c644afc 100644 --- a/lib/isc/unix/stdio.c +++ b/lib/isc/unix/stdio.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2004, 2007 Internet Systems Consortium, Inc. ("ISC") + * Copyright (C) 2004, 2007, 2011, 2012 Internet Systems Consortium, Inc. ("ISC") * Copyright (C) 2000, 2001 Internet Software Consortium. * * Permission to use, copy, modify, and/or distribute this software for any @@ -15,7 +15,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: stdio.c,v 1.8 2007/06/19 23:47:18 tbox Exp $ */ +/* $Id$ */ #include <config.h> @@ -23,6 +23,7 @@ #include <unistd.h> #include <isc/stdio.h> +#include <isc/stat.h> #include "errno2result.h" @@ -104,12 +105,23 @@ isc_stdio_flush(FILE *f) { return (isc__errno2result(errno)); } +/* + * OpenBSD has deprecated ENOTSUP in favor of EOPNOTSUPP. + */ +#if defined(EOPNOTSUPP) && !defined(ENOTSUP) +#define ENOTSUP EOPNOTSUPP +#endif + isc_result_t isc_stdio_sync(FILE *f) { int r; r = fsync(fileno(f)); - if (r == 0) + /* + * fsync is not supported on sockets and pipes which + * result in EINVAL / ENOTSUP. + */ + if (r == 0 || errno == EINVAL || errno == ENOTSUP) return (ISC_R_SUCCESS); else return (isc__errno2result(errno)); |