[core] stat_cache_path_isdir()

master
Glenn Strauss 2 years ago
parent 14eb97f1b3
commit 7d368cd7a5

@ -1048,6 +1048,11 @@ stat_cache_entry * stat_cache_get_entry(const buffer *name) {
return sce;
}
int stat_cache_path_isdir(const buffer *name) {
const stat_cache_entry * const sce = stat_cache_get_entry(name);
return (sce && (S_ISDIR(sce->st.st_mode) ? 1 : (errno = ENOTDIR, 0)));
}
int stat_cache_path_contains_symlink(const buffer *name, log_error_st *errh) {
/* caller should check for symlinks only if we should block symlinks. */

@ -50,6 +50,7 @@ void stat_cache_delete_entry(const char *name, uint32_t len);
void stat_cache_delete_dir(const char *name, uint32_t len);
void stat_cache_invalidate_entry(const char *name, uint32_t len);
stat_cache_entry * stat_cache_get_entry(const buffer *name);
int stat_cache_path_isdir(const buffer *name);
__attribute_cold__
int stat_cache_path_contains_symlink(const buffer *name, log_error_st *errh);

Loading…
Cancel
Save