From: Mark Andrews Date: Thu, 30 Aug 2001 04:55:36 +0000 (+0000) Subject: isc_file_truncate() X-Git-Tag: v9.2.2rc1^3~19 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=59251c9e9c2135bdb64ccf970f0a769a0bbe30ab;p=thirdparty%2Fbind9.git isc_file_truncate() --- diff --git a/lib/isc/include/isc/file.h b/lib/isc/include/isc/file.h index 649fef45745..aabbc44cd51 100644 --- a/lib/isc/include/isc/file.h +++ b/lib/isc/include/isc/file.h @@ -15,7 +15,7 @@ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: file.h,v 1.24 2001/07/16 18:33:00 gson Exp $ */ +/* $Id: file.h,v 1.25 2001/08/30 04:55:34 marka Exp $ */ #ifndef ISC_FILE_H #define ISC_FILE_H 1 @@ -241,6 +241,12 @@ isc_file_absolutepath(const char *filename, char *path, size_t pathlen); * (see write_open() in BIND 8's ns_config.c). */ +isc_result_t +isc_file_truncate(const char *filename, isc_offset_t size); +/* + * Truncate/Extend the file specified to 'size' bytes. + */ + ISC_LANG_ENDDECLS #endif /* ISC_FILE_H */ diff --git a/lib/isc/unix/file.c b/lib/isc/unix/file.c index da002828129..1594c999b85 100644 --- a/lib/isc/unix/file.c +++ b/lib/isc/unix/file.c @@ -15,7 +15,7 @@ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: file.c,v 1.38 2001/07/16 18:33:01 gson Exp $ */ +/* $Id: file.c,v 1.39 2001/08/30 04:55:36 marka Exp $ */ #include @@ -313,3 +313,12 @@ isc_file_absolutepath(const char *filename, char *path, size_t pathlen) { strcat(path, filename); return (ISC_R_SUCCESS); } + +isc_result_t +isc_file_truncate(const char *filename, isc_offset_t size) { + isc_result_t result = ISC_R_SUCCESS; + + if (truncate(filename, size) < 0) + result = isc__errno2result(errno); + return (result); +}