From 7ec4367f3d578170a9495ff3c851b248c1656f08 Mon Sep 17 00:00:00 2001 From: Andreas Gustafsson Date: Fri, 8 Sep 2000 18:37:28 +0000 Subject: [PATCH] 434. [func] New function isc_file_isabsolute(). --- CHANGES | 2 ++ lib/isc/include/isc/file.h | 9 +++++++-- lib/isc/unix/file.c | 7 ++++++- 3 files changed, 15 insertions(+), 3 deletions(-) diff --git a/CHANGES b/CHANGES index aabc534302..3ccab4ae87 100644 --- a/CHANGES +++ b/CHANGES @@ -1,4 +1,6 @@ + 434. [func] New function isc_file_isabsolute(). + 433. [func] isc_base64_decodestring() now accepts newlines within the base64 data. This makes it possible to break up the key data in a "trusted-keys" diff --git a/lib/isc/include/isc/file.h b/lib/isc/include/isc/file.h index a2ea5c6ed9..cd4480d284 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.9 2000/08/01 01:30:10 tale Exp $ */ +/* $Id: file.h,v 1.10 2000/09/08 18:37:25 gson Exp $ */ #ifndef ISC_FILE_H #define ISC_FILE_H 1 @@ -159,13 +159,18 @@ isc_file_remove(const char *filename); * Remove the file named by 'filename'. */ +isc_boolean_t +isc_file_isabsolute(const char *filename); +/* + * Return ISC_TRUE iff the given file name is absolute. + */ + /* * XXX We should also have a isc_file_writeeopen() function * for safely open a file in a publicly writable directory * (see write_open() in BIND 8's ns_config.c). */ - ISC_LANG_ENDDECLS #endif /* ISC_FILE_H */ diff --git a/lib/isc/unix/file.c b/lib/isc/unix/file.c index 48beaea7a9..e67bac21c2 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.20 2000/08/01 01:31:16 tale Exp $ */ +/* $Id: file.c,v 1.21 2000/09/08 18:37:26 gson Exp $ */ #include @@ -180,3 +180,8 @@ isc_file_remove(const char *filename) { else return (isc__errno2result(errno)); } + +isc_boolean_t +isc_file_isabsolute(const char *filename) { + return (ISC_TF(filename[0] == '/')); +}