Commit d8e34837 authored by David Lawrence's avatar David Lawrence
Browse files

isc_file_{stdiofunc} -> isc_stdio_*

parent 80150fb0
...@@ -23,6 +23,7 @@ ...@@ -23,6 +23,7 @@
#include <isc/file.h> #include <isc/file.h>
#include <isc/mem.h> #include <isc/mem.h>
#include <isc/net.h> /* Required for ntohl. */ #include <isc/net.h> /* Required for ntohl. */
#include <isc/stdio.h>
#include <isc/string.h> #include <isc/string.h>
#include <isc/util.h> #include <isc/util.h>
...@@ -95,8 +96,7 @@ rdata_covers(dns_rdata_t *rdata) { ...@@ -95,8 +96,7 @@ rdata_covers(dns_rdata_t *rdata) {
} }
isc_uint32_t isc_uint32_t
dns_soa_getserial(dns_rdata_t *rdata) dns_soa_getserial(dns_rdata_t *rdata) {
{
INSIST(rdata->type == dns_rdatatype_soa); INSIST(rdata->type == dns_rdatatype_soa);
/* /*
* Locate the serial number within the SOA RDATA based * Locate the serial number within the SOA RDATA based
...@@ -115,8 +115,7 @@ dns_soa_getserial(dns_rdata_t *rdata) ...@@ -115,8 +115,7 @@ dns_soa_getserial(dns_rdata_t *rdata)
} }
void void
dns_soa_setserial(isc_uint32_t val, dns_rdata_t *rdata) dns_soa_setserial(isc_uint32_t val, dns_rdata_t *rdata) {
{
INSIST(rdata->type == dns_rdatatype_soa); INSIST(rdata->type == dns_rdatatype_soa);
INSIST(rdata->length > 20); INSIST(rdata->length > 20);
encode_uint32(val, rdata->data + rdata->length - 20); encode_uint32(val, rdata->data + rdata->length - 20);
...@@ -907,7 +906,7 @@ journal_header_encode(journal_header_t *cooked, journal_rawheader_t *raw) { ...@@ -907,7 +906,7 @@ journal_header_encode(journal_header_t *cooked, journal_rawheader_t *raw) {
static isc_result_t static isc_result_t
journal_seek(dns_journal_t *j, isc_uint32_t offset) { journal_seek(dns_journal_t *j, isc_uint32_t offset) {
isc_result_t result; isc_result_t result;
result = isc_file_fseek(j->fp, (long) offset, SEEK_SET); result = isc_stdio_seek(j->fp, (long)offset, SEEK_SET);
if (result != ISC_R_SUCCESS) { if (result != ISC_R_SUCCESS) {
isc_log_write(JOURNAL_COMMON_LOGARGS, ISC_LOG_ERROR, isc_log_write(JOURNAL_COMMON_LOGARGS, ISC_LOG_ERROR,
"%s: seek: %s", j->filename, "%s: seek: %s", j->filename,
...@@ -922,7 +921,7 @@ static isc_result_t ...@@ -922,7 +921,7 @@ static isc_result_t
journal_read(dns_journal_t *j, void *mem, size_t nbytes) { journal_read(dns_journal_t *j, void *mem, size_t nbytes) {
isc_result_t result; isc_result_t result;
result = isc_file_fread(mem, 1, nbytes, j->fp, NULL); result = isc_stdio_read(mem, 1, nbytes, j->fp, NULL);
if (result != ISC_R_SUCCESS) { if (result != ISC_R_SUCCESS) {
if (result == ISC_R_EOF) if (result == ISC_R_EOF)
return (ISC_R_NOMORE); return (ISC_R_NOMORE);
...@@ -939,7 +938,7 @@ static isc_result_t ...@@ -939,7 +938,7 @@ static isc_result_t
journal_write(dns_journal_t *j, void *mem, size_t nbytes) { journal_write(dns_journal_t *j, void *mem, size_t nbytes) {
isc_result_t result; isc_result_t result;
result = isc_file_fwrite(mem, 1, nbytes, j->fp, NULL); result = isc_stdio_write(mem, 1, nbytes, j->fp, NULL);
if (result != ISC_R_SUCCESS) { if (result != ISC_R_SUCCESS) {
isc_log_write(JOURNAL_COMMON_LOGARGS, ISC_LOG_ERROR, isc_log_write(JOURNAL_COMMON_LOGARGS, ISC_LOG_ERROR,
"%s: write: %s", "%s: write: %s",
...@@ -953,14 +952,14 @@ journal_write(dns_journal_t *j, void *mem, size_t nbytes) { ...@@ -953,14 +952,14 @@ journal_write(dns_journal_t *j, void *mem, size_t nbytes) {
static isc_result_t static isc_result_t
journal_fsync(dns_journal_t *j) { journal_fsync(dns_journal_t *j) {
isc_result_t result; isc_result_t result;
result = isc_file_fflush(j->fp); result = isc_stdio_flush(j->fp);
if (result != ISC_R_SUCCESS) { if (result != ISC_R_SUCCESS) {
isc_log_write(JOURNAL_COMMON_LOGARGS, ISC_LOG_ERROR, isc_log_write(JOURNAL_COMMON_LOGARGS, ISC_LOG_ERROR,
"%s: flush: %s", "%s: flush: %s",
j->filename, isc_result_totext(result)); j->filename, isc_result_totext(result));
return (ISC_R_UNEXPECTED); return (ISC_R_UNEXPECTED);
} }
result = isc_file_ffsync(j->fp); result = isc_stdio_sync(j->fp);
if (result != ISC_R_SUCCESS) { if (result != ISC_R_SUCCESS) {
isc_log_write(JOURNAL_COMMON_LOGARGS, ISC_LOG_ERROR, isc_log_write(JOURNAL_COMMON_LOGARGS, ISC_LOG_ERROR,
"%s: fsync: %s", "%s: fsync: %s",
...@@ -1026,7 +1025,7 @@ journal_file_create(isc_mem_t *mctx, const char *filename) { ...@@ -1026,7 +1025,7 @@ journal_file_create(isc_mem_t *mctx, const char *filename) {
INSIST(sizeof(journal_rawheader_t) == JOURNAL_HEADER_SIZE); INSIST(sizeof(journal_rawheader_t) == JOURNAL_HEADER_SIZE);
result = isc_file_fopen(filename, "w", &fp); result = isc_stdio_open(filename, "w", &fp);
if (result != ISC_R_SUCCESS) { if (result != ISC_R_SUCCESS) {
isc_log_write(JOURNAL_COMMON_LOGARGS, ISC_LOG_ERROR, isc_log_write(JOURNAL_COMMON_LOGARGS, ISC_LOG_ERROR,
"%s: create: %s", "%s: create: %s",
...@@ -1043,26 +1042,26 @@ journal_file_create(isc_mem_t *mctx, const char *filename) { ...@@ -1043,26 +1042,26 @@ journal_file_create(isc_mem_t *mctx, const char *filename) {
mem = isc_mem_get(mctx, size); mem = isc_mem_get(mctx, size);
if (mem == NULL) { if (mem == NULL) {
(void)isc_file_fclose(fp); (void)isc_stdio_close(fp);
(void)isc_file_remove(filename); (void)isc_file_remove(filename);
return (ISC_R_NOMEMORY); return (ISC_R_NOMEMORY);
} }
memset(mem, 0, size); memset(mem, 0, size);
memcpy(mem, &rawheader, sizeof(rawheader)); memcpy(mem, &rawheader, sizeof(rawheader));
result = isc_file_fwrite(mem, 1, (size_t) size, fp, NULL); result = isc_stdio_write(mem, 1, (size_t) size, fp, NULL);
if (result != ISC_R_SUCCESS) { if (result != ISC_R_SUCCESS) {
isc_log_write(JOURNAL_COMMON_LOGARGS, ISC_LOG_ERROR, isc_log_write(JOURNAL_COMMON_LOGARGS, ISC_LOG_ERROR,
"%s: write: %s", "%s: write: %s",
filename, isc_result_totext(result)); filename, isc_result_totext(result));
(void)isc_file_fclose(fp); (void)isc_stdio_close(fp);
(void)isc_file_remove(filename); (void)isc_file_remove(filename);
isc_mem_put(mctx, mem, size); isc_mem_put(mctx, mem, size);
return (ISC_R_UNEXPECTED); return (ISC_R_UNEXPECTED);
} }
isc_mem_put(mctx, mem, size); isc_mem_put(mctx, mem, size);
result = isc_file_fclose(fp); result = isc_stdio_close(fp);
if (result != ISC_R_SUCCESS) { if (result != ISC_R_SUCCESS) {
isc_log_write(JOURNAL_COMMON_LOGARGS, ISC_LOG_ERROR, isc_log_write(JOURNAL_COMMON_LOGARGS, ISC_LOG_ERROR,
"%s: close: %s", "%s: close: %s",
...@@ -1094,8 +1093,7 @@ dns_journal_open(isc_mem_t *mctx, const char *filename, isc_boolean_t write, ...@@ -1094,8 +1093,7 @@ dns_journal_open(isc_mem_t *mctx, const char *filename, isc_boolean_t write,
j->filename = filename; j->filename = filename;
j->index = NULL; j->index = NULL;
/* XXX isc_file_fopen() may need "b" (binary) on some platforms */ result = isc_stdio_open(j->filename, write ? "rb+" : "rb", &fp);
result = isc_file_fopen(j->filename, write ? "r+" : "r", &fp);
if (result == ISC_R_FILENOTFOUND) { if (result == ISC_R_FILENOTFOUND) {
if (write) { if (write) {
...@@ -1105,8 +1103,10 @@ dns_journal_open(isc_mem_t *mctx, const char *filename, isc_boolean_t write, ...@@ -1105,8 +1103,10 @@ dns_journal_open(isc_mem_t *mctx, const char *filename, isc_boolean_t write,
"creating it", "creating it",
j->filename); j->filename);
CHECK(journal_file_create(mctx, filename)); CHECK(journal_file_create(mctx, filename));
/* Retry. */ /*
result = isc_file_fopen(j->filename, "r+", &fp); * Retry.
*/
result = isc_stdio_open(j->filename, "rb+", &fp);
} else { } else {
FAIL(ISC_R_NOTFOUND); FAIL(ISC_R_NOTFOUND);
} }
...@@ -1199,7 +1199,7 @@ dns_journal_open(isc_mem_t *mctx, const char *filename, isc_boolean_t write, ...@@ -1199,7 +1199,7 @@ dns_journal_open(isc_mem_t *mctx, const char *filename, isc_boolean_t write,
j->index = NULL; j->index = NULL;
} }
if (j->fp != NULL) if (j->fp != NULL)
(void)isc_file_fclose(j->fp); (void)isc_stdio_close(j->fp);
isc_mem_put(j->mctx, j, sizeof(*j)); isc_mem_put(j->mctx, j, sizeof(*j));
return (result); return (result);
} }
...@@ -1699,7 +1699,7 @@ dns_journal_destroy(dns_journal_t **journalp) { ...@@ -1699,7 +1699,7 @@ dns_journal_destroy(dns_journal_t **journalp) {
isc_mem_put(j->mctx, j->it.source.base, j->it.source.length); isc_mem_put(j->mctx, j->it.source.base, j->it.source.length);
if (j->fp != NULL) if (j->fp != NULL)
(void)isc_file_fclose(j->fp); (void)isc_stdio_close(j->fp);
j->magic = 0; j->magic = 0;
isc_mem_put(j->mctx, j, sizeof(*j)); isc_mem_put(j->mctx, j, sizeof(*j));
*journalp = NULL; *journalp = NULL;
......
...@@ -21,6 +21,7 @@ ...@@ -21,6 +21,7 @@
#include <isc/file.h> #include <isc/file.h>
#include <isc/mem.h> #include <isc/mem.h>
#include <isc/stdio.h>
#include <isc/string.h> #include <isc/string.h>
#include <isc/util.h> #include <isc/util.h>
...@@ -550,7 +551,6 @@ dump_rdataset(isc_mem_t *mctx, dns_name_t *name, dns_rdataset_t *rdataset, ...@@ -550,7 +551,6 @@ dump_rdataset(isc_mem_t *mctx, dns_name_t *name, dns_rdataset_t *rdataset,
{ {
isc_region_t r; isc_region_t r;
isc_result_t result; isc_result_t result;
size_t nwritten;
REQUIRE(buffer->length > 0); REQUIRE(buffer->length > 0);
...@@ -603,15 +603,17 @@ dump_rdataset(isc_mem_t *mctx, dns_name_t *name, dns_rdataset_t *rdataset, ...@@ -603,15 +603,17 @@ dump_rdataset(isc_mem_t *mctx, dns_name_t *name, dns_rdataset_t *rdataset,
if (result != ISC_R_SUCCESS) if (result != ISC_R_SUCCESS)
return (result); return (result);
/* Write the buffer contents to the master file. */ /*
* Write the buffer contents to the master file.
*/
isc_buffer_usedregion(buffer, &r); isc_buffer_usedregion(buffer, &r);
nwritten = fwrite(r.base, 1, (size_t) r.length, f); result = isc_stdio_write(r.base, 1, (size_t)r.length, f, NULL);
if (nwritten != (size_t) r.length) { if (result != ISC_R_SUCCESS) {
UNEXPECTED_ERROR(__FILE__, __LINE__, UNEXPECTED_ERROR(__FILE__, __LINE__,
"master file write failed: %s", "master file write failed: %s",
strerror(errno)); isc_result_totext(result));
return (ISC_R_UNEXPECTED); return (result);
} }
return (ISC_R_SUCCESS); return (ISC_R_SUCCESS);
...@@ -784,7 +786,7 @@ dns_master_dump(isc_mem_t *mctx, dns_db_t *db, dns_dbversion_t *version, ...@@ -784,7 +786,7 @@ dns_master_dump(isc_mem_t *mctx, dns_db_t *db, dns_dbversion_t *version,
FILE *f = NULL; FILE *f = NULL;
isc_result_t result; isc_result_t result;
result = isc_file_fopen(filename, "w", &f); result = isc_stdio_open(filename, "w", &f);
if (result != ISC_R_SUCCESS) { if (result != ISC_R_SUCCESS) {
isc_log_write(dns_lctx, ISC_LOGCATEGORY_GENERAL, isc_log_write(dns_lctx, ISC_LOGCATEGORY_GENERAL,
DNS_LOGMODULE_MASTERDUMP, ISC_LOG_ERROR, DNS_LOGMODULE_MASTERDUMP, ISC_LOG_ERROR,
...@@ -795,7 +797,7 @@ dns_master_dump(isc_mem_t *mctx, dns_db_t *db, dns_dbversion_t *version, ...@@ -795,7 +797,7 @@ dns_master_dump(isc_mem_t *mctx, dns_db_t *db, dns_dbversion_t *version,
result = dns_master_dumptostream(mctx, db, version, style, f); result = dns_master_dumptostream(mctx, db, version, style, f);
result = isc_file_fclose(f); result = isc_stdio_close(f);
if (result != ISC_R_SUCCESS) { if (result != ISC_R_SUCCESS) {
isc_log_write(dns_lctx, ISC_LOGCATEGORY_GENERAL, isc_log_write(dns_lctx, ISC_LOGCATEGORY_GENERAL,
DNS_LOGMODULE_MASTERDUMP, ISC_LOG_ERROR, DNS_LOGMODULE_MASTERDUMP, ISC_LOG_ERROR,
......
...@@ -32,7 +32,7 @@ CWARNINGS = ...@@ -32,7 +32,7 @@ CWARNINGS =
UNIXOBJS = @ISC_ISCIPV6_O@ \ UNIXOBJS = @ISC_ISCIPV6_O@ \
unix/app.@O@ unix/dir.@O@ unix/errno2result.@O@ unix/file.@O@ \ unix/app.@O@ unix/dir.@O@ unix/errno2result.@O@ unix/file.@O@ \
unix/interfaceiter.@O@ unix/net.@O@ unix/socket.@O@ \ unix/interfaceiter.@O@ unix/net.@O@ unix/socket.@O@ \
unix/time.@O@ unix/stdtime.@O@ unix/time.@O@ unix/stdio.@O@ unix/stdtime.@O@
NLSOBJS = nls/msgcat.@O@ NLSOBJS = nls/msgcat.@O@
......
...@@ -29,7 +29,7 @@ HEADERS = assertions.h base64.h bitstring.h boolean.h buffer.h \ ...@@ -29,7 +29,7 @@ HEADERS = assertions.h base64.h bitstring.h boolean.h buffer.h \
mutexblock.h netaddr.h ondestroy.h platform.h \ mutexblock.h netaddr.h ondestroy.h platform.h \
print.h quota.h random.h ratelimiter.h region.h \ print.h quota.h random.h ratelimiter.h region.h \
result.h resultclass.h rwlock.h serial.h sockaddr.h \ result.h resultclass.h rwlock.h serial.h sockaddr.h \
socket.h string.h symtab.h task.h taskpool.h timer.h \ socket.h stdio.h string.h symtab.h task.h taskpool.h timer.h \
types.h util.h types.h util.h
SUBDIRS = SUBDIRS =
......
...@@ -148,45 +148,6 @@ isc_file_openunique(char *templet, FILE **fp); ...@@ -148,45 +148,6 @@ isc_file_openunique(char *templet, FILE **fp);
* Something totally unexpected happened. * Something totally unexpected happened.
*/ */
isc_result_t
isc_file_fopen(const char *filename, const char *mode, FILE **fp);
isc_result_t
isc_file_fclose(FILE *f);
isc_result_t
isc_file_fseek(FILE *f, long offset, int whence);
isc_result_t
isc_file_fread(void *ptr, size_t size, size_t nmemb, FILE *f,
size_t *nret);
isc_result_t
isc_file_fwrite(const void *ptr, size_t size, size_t nmemb, FILE *f,
size_t *nret);
isc_result_t
isc_file_fflush(FILE *f);
/*
* These functions are wrappers around the corresponding
* stdio functions, returning a detailed error code in the
* form of an an isc_result_t. ANSI C does not guarantee
* that stdio functions set errno, hence these functions
* must use platform dependent methods (e.g., the POSIX errno)
* to construct the error code.
*/
isc_result_t
isc_file_ffsync(FILE *f);
/*
* Invoke fsync() on the file descriptor underlying
* an stdio stream, or an equivalent system-dependent
* operation. Note that this function has no direct
* counterpart in the stdio library.
*/
isc_result_t isc_result_t
isc_file_remove(const char *filename); isc_file_remove(const char *filename);
/* /*
......
/*
* Copyright (C) 2000 Internet Software Consortium.
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS
* ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE
* CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
* DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
* PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
* ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
* SOFTWARE.
*/
#include <stdio.h>
#include <isc/result.h>
isc_result_t
isc_stdio_open(const char *filename, const char *mode, FILE **fp);
isc_result_t
isc_stdio_close(FILE *f);
isc_result_t
isc_stdio_seek(FILE *f, long offset, int whence);
isc_result_t
isc_stdio_read(void *ptr, size_t size, size_t nmemb, FILE *f,
size_t *nret);
isc_result_t
isc_stdio_write(const void *ptr, size_t size, size_t nmemb, FILE *f,
size_t *nret);
isc_result_t
isc_stdio_flush(FILE *f);
/*
* These functions are wrappers around the corresponding stdio functions,
* returning a detailed error code in the form of an an isc_result_t. ANSI C
* does not guarantee that stdio functions set errno, hence these functions
* must use platform dependent methods (e.g., the POSIX errno) to construct the
* error code.
*/
isc_result_t
isc_stdio_sync(FILE *f);
/*
* Invoke fsync() on the file descriptor underlying an stdio stream, or an
* equivalent system-dependent operation. Note that this function has no
* direct counterpart in the stdio library.
*/
...@@ -24,6 +24,7 @@ ...@@ -24,6 +24,7 @@
#include <isc/file.h> #include <isc/file.h>
#include <isc/lex.h> #include <isc/lex.h>
#include <isc/mem.h> #include <isc/mem.h>
#include <isc/stdio.h>
#include <isc/string.h> #include <isc/string.h>
#include <isc/util.h> #include <isc/util.h>
...@@ -220,7 +221,7 @@ isc_lex_openfile(isc_lex_t *lex, const char *filename) { ...@@ -220,7 +221,7 @@ isc_lex_openfile(isc_lex_t *lex, const char *filename) {
REQUIRE(VALID_LEX(lex)); REQUIRE(VALID_LEX(lex));
result = isc_file_fopen(filename, "r", &stream); result = isc_stdio_open(filename, "r", &stream);
if (result != ISC_R_SUCCESS) if (result != ISC_R_SUCCESS)
return (result); return (result);
......
...@@ -29,12 +29,12 @@ CWARNINGS = ...@@ -29,12 +29,12 @@ CWARNINGS =
# Alphabetically # Alphabetically
OBJS = @ISC_IPV6_O@ \ OBJS = @ISC_IPV6_O@ \
app.@O@ dir.@O@ errno2result.@O@ file.@O@ interfaceiter.@O@ \ app.@O@ dir.@O@ errno2result.@O@ file.@O@ interfaceiter.@O@ \
net.@O@ socket.@O@ stdtime.@O@ time.@O@ net.@O@ socket.@O@ stdio.@O@ stdtime.@O@ time.@O@
# Alphabetically # Alphabetically
SRCS = @ISC_IPV6_C@ \ SRCS = @ISC_IPV6_C@ \
app.c dir.c errno2result.c file.c interfaceiter.c \ app.c dir.c errno2result.c file.c interfaceiter.c \
net.c socket.c stdtime.c time.c net.c socket.c stdio.c stdtime.c time.c
SUBDIRS = include SUBDIRS = include
TARGETS = ${OBJS} TARGETS = ${OBJS}
......
...@@ -125,93 +125,6 @@ isc_file_openunique(char *templet, FILE **fp) { ...@@ -125,93 +125,6 @@ isc_file_openunique(char *templet, FILE **fp) {
return (result); return (result);
} }
isc_result_t
isc_file_fopen(const char *filename, const char *mode, FILE **fp) {
FILE *f;
f = fopen(filename, mode);
if (f == NULL)
return (isc__errno2result(errno));
*fp = f;
return (ISC_R_SUCCESS);
}
isc_result_t
isc_file_fclose(FILE *f) {
int r;
r = fclose(f);
if (r == 0)
return (ISC_R_SUCCESS);
else
return (isc__errno2result(errno));
}
isc_result_t
isc_file_fseek(FILE *f, long offset, int whence) {
int r;
r = fseek(f, offset, whence);
if (r == 0)
return (ISC_R_SUCCESS);
else
return (isc__errno2result(errno));
}
isc_result_t
isc_file_fread(void *ptr, size_t size, size_t nmemb, FILE *f, size_t *nret) {
isc_result_t result = ISC_R_SUCCESS;
size_t r;
clearerr(f);
r = fread(ptr, size, nmemb, f);
if (r != nmemb) {
if (feof(f))
result = ISC_R_EOF;
else
result = isc__errno2result(errno);
}
if (nret != NULL)
*nret = r;
return (result);
}
isc_result_t
isc_file_fwrite(const void *ptr, size_t size, size_t nmemb, FILE *f, size_t *nret) {
isc_result_t result = ISC_R_SUCCESS;
size_t r;
clearerr(f);
r = fwrite(ptr, size, nmemb, f);
if (r != nmemb)
result = isc__errno2result(errno);
if (nret != NULL)
*nret = r;
return (result);
}
isc_result_t
isc_file_fflush(FILE *f) {
int r;
r = fflush(f);
if (r == 0)
return (ISC_R_SUCCESS);
else
return (isc__errno2result(errno));
}
isc_result_t
isc_file_ffsync(FILE *f) {
int r;
r = fsync(fileno(f));
if (r == 0)
return (ISC_R_SUCCESS);
else
return (isc__errno2result(errno));
}
isc_result_t isc_result_t
isc_file_remove(const char *filename) { isc_file_remove(const char *filename) {
int r; int r;
......
/*
* Copyright (C) 2000 Internet Software Consortium.
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS
* ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE
* CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
* DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
* PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
* ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
* SOFTWARE.
*/
#include <config.h>
#include <errno.h>
#include <unistd.h>
#include <isc/stdio.h>
#include "errno2result.h"
isc_result_t
isc_stdio_open(const char *filename, const char *mode, FILE **fp) {
FILE *f;