mirror of
https://gitlab.isc.org/isc-projects/bind9
synced 2025-08-31 14:35:26 +00:00
Ensure that log files are plain files. (RT #22771)
This commit is contained in:
@@ -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.58 2011/03/04 14:07:03 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);
|
||||
|
@@ -15,7 +15,7 @@
|
||||
* PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
/* $Id: stdio.c,v 1.8 2007/06/19 23:47:18 tbox Exp $ */
|
||||
/* $Id: stdio.c,v 1.9 2011/03/04 14:07:03 smann Exp $ */
|
||||
|
||||
#include <config.h>
|
||||
|
||||
@@ -23,6 +23,7 @@
|
||||
#include <unistd.h>
|
||||
|
||||
#include <isc/stdio.h>
|
||||
#include <isc/stat.h>
|
||||
|
||||
#include "errno2result.h"
|
||||
|
||||
|
Reference in New Issue
Block a user