summaryrefslogtreecommitdiff
path: root/lib/isc/unix/file.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/isc/unix/file.c')
-rw-r--r--lib/isc/unix/file.c19
1 files changed, 18 insertions, 1 deletions
diff --git a/lib/isc/unix/file.c b/lib/isc/unix/file.c
index 25d856cc6c781..3e4d3e01f4d5c 100644
--- a/lib/isc/unix/file.c
+++ b/lib/isc/unix/file.c
@@ -48,7 +48,7 @@
* SUCH DAMAGE.
*/
-/* $Id: file.c,v 1.57 2011-01-11 23:47:14 tbox Exp $ */
+/* $Id: file.c,v 1.57.10.1 2011-03-04 14:10:13 smann Exp $ */
/*! \file */
@@ -348,6 +348,23 @@ isc_file_exists(const char *pathname) {
return (ISC_TF(file_stats(pathname, &stats) == ISC_R_SUCCESS));
}
+isc_result_t
+isc_file_isplainfile(const char *filename) {
+ /*
+ * This function returns success if filename is a plain file.
+ */
+ struct stat filestat;
+ memset(&filestat,0,sizeof(struct stat));
+
+ if ((stat(filename, &filestat)) == -1)
+ return(isc__errno2result(errno));
+
+ if(! S_ISREG(filestat.st_mode))
+ return(ISC_R_INVALIDFILE);
+
+ return(ISC_R_SUCCESS);
+}
+
isc_boolean_t
isc_file_isabsolute(const char *filename) {
REQUIRE(filename != NULL);