Browse Source

[core] stat_cache_path_isdir()

master
Glenn Strauss 8 months ago
parent
commit
7d368cd7a5
  1. 5
      src/stat_cache.c
  2. 1
      src/stat_cache.h

5
src/stat_cache.c

@ -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. */

1
src/stat_cache.h

@ -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