diff options
Diffstat (limited to 'lib/isc/unix/stdio.c')
-rw-r--r-- | lib/isc/unix/stdio.c | 21 |
1 files changed, 18 insertions, 3 deletions
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 <isc/stdio.h> #include <isc/stat.h> +#include <isc/util.h> #include "errno2result.h" @@ -50,10 +51,10 @@ 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 @@ -61,6 +62,20 @@ isc_stdio_seek(FILE *f, long offset, int whence) { } 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; size_t r; |