stat-util: add fd_verify_symlink() helper

This commit is contained in:
Lennart Poettering
2025-10-14 11:21:46 +02:00
parent 90fae0b46c
commit 8be204df2b
2 changed files with 5 additions and 0 deletions
+4
View File
@@ -108,6 +108,10 @@ int stat_verify_symlink(const struct stat *st) {
return 0;
}
int fd_verify_symlink(int fd) {
return verify_stat_at(fd, /* path= */ NULL, /* follow= */ false, stat_verify_symlink, /* verify= */ true);
}
int is_symlink(const char *path) {
assert(!isempty(path));
return verify_stat_at(AT_FDCWD, path, false, stat_verify_symlink, false);
+1
View File
@@ -16,6 +16,7 @@ int is_dir_at(int fd, const char *path, bool follow);
int is_dir(const char *path, bool follow);
int stat_verify_symlink(const struct stat *st);
int fd_verify_symlink(int fd);
int is_symlink(const char *path);
int stat_verify_linked(const struct stat *st);