From 5632ddb849821bf8c4fac9f4aa8c4779575eef97 Mon Sep 17 00:00:00 2001 From: Denys Vlasenko Date: Wed, 30 Sep 2009 15:15:08 +0200 Subject: fix all instances of dent->d_type == DT_REG checks Signed-off-by: Denys Vlasenko --- inc/abrtlib.h | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'inc') diff --git a/inc/abrtlib.h b/inc/abrtlib.h index c99f4b7e..02906f2f 100644 --- a/inc/abrtlib.h +++ b/inc/abrtlib.h @@ -122,6 +122,13 @@ void xbind(int sockfd, struct sockaddr *my_addr, socklen_t addrlen); void xlisten(int s, int backlog); ssize_t xsendto(int s, const void *buf, size_t len, const struct sockaddr *to, socklen_t tolen); void xstat(const char *name, struct stat *stat_buf); +/* Just testing dent->d_type == DT_REG is wrong: some filesystems + * do not report the type, they report DT_UNKNOWN for every dirent + * (and this is not a bug in filesystem, this is allowed by standards). + * This function handles this case. Note: it returns 0 on symlinks + * even if they point to regular files. + */ +int is_regular_file(struct dirent *dent, const char *dirname); void xmove_fd(int from, int to); char* xasprintf(const char *format, ...); -- cgit