From e83d3091807de4060c0f7654609c0ba97c607698 Mon Sep 17 00:00:00 2001 From: Erwin Lansing Date: Mon, 24 Feb 2014 13:57:07 +0000 Subject: Vendor import of BIND 9.8.7 Approved by: delphij (mentor, implicit) Sponsored by: DK Hostmaster A/S --- lib/isc/unix/stdio.c | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) (limited to 'lib/isc/unix/stdio.c') diff --git a/lib/isc/unix/stdio.c b/lib/isc/unix/stdio.c index 360c8c644afc2..90e3b2ab3079f 100644 --- a/lib/isc/unix/stdio.c +++ b/lib/isc/unix/stdio.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2004, 2007, 2011, 2012 Internet Systems Consortium, Inc. ("ISC") + * Copyright (C) 2004, 2007, 2011-2013 Internet Systems Consortium, Inc. ("ISC") * Copyright (C) 2000, 2001 Internet Software Consortium. * * Permission to use, copy, modify, and/or distribute this software for any @@ -24,6 +24,7 @@ #include #include +#include #include "errno2result.h" @@ -50,16 +51,30 @@ isc_stdio_close(FILE *f) { } isc_result_t -isc_stdio_seek(FILE *f, long offset, int whence) { +isc_stdio_seek(FILE *f, off_t offset, int whence) { int r; - r = fseek(f, offset, whence); + r = fseeko(f, offset, whence); if (r == 0) return (ISC_R_SUCCESS); else return (isc__errno2result(errno)); } +isc_result_t +isc_stdio_tell(FILE *f, off_t *offsetp) { + off_t r; + + REQUIRE(offsetp != NULL); + + r = ftello(f); + if (r >= 0) { + *offsetp = r; + return (ISC_R_SUCCESS); + } else + return (isc__errno2result(errno)); +} + isc_result_t isc_stdio_read(void *ptr, size_t size, size_t nmemb, FILE *f, size_t *nret) { isc_result_t result = ISC_R_SUCCESS; -- cgit v1.2.3