]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
isc_file_truncate()
authorMark Andrews <marka@isc.org>
Thu, 30 Aug 2001 04:55:36 +0000 (04:55 +0000)
committerMark Andrews <marka@isc.org>
Thu, 30 Aug 2001 04:55:36 +0000 (04:55 +0000)
lib/isc/include/isc/file.h
lib/isc/unix/file.c

index 649fef457458eaf9b353d0fd0ce6fa739a7b3418..aabbc44cd51bbb5392521a88beeb5ac05497d4d4 100644 (file)
@@ -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 */
index da002828129a06f22518a07dcb84fd4996d4337c..1594c999b85074b3ef02cc47a2362246215a2833 100644 (file)
@@ -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 <config.h>
 
@@ -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);
+}