[augeas-devel] augeas: master - Only read regular files
David Lutterkort
lutter at fedoraproject.org
Fri Aug 14 21:19:29 UTC 2009
Gitweb: http://git.fedorahosted.org/git/augeas.git?p=augeas.git;a=commitdiff;h=c6e703f9a4bfeac2b382965f9686729727020fbb
Commit: c6e703f9a4bfeac2b382965f9686729727020fbb
Parent: ca5b2996127574acd2aed91dbd3d763ecc8ef613
Author: David Lutterkort <lutter at redhat.com>
AuthorDate: Wed Aug 12 16:54:52 2009 -0700
Committer: David Lutterkort <lutter at redhat.com>
CommitterDate: Fri Aug 14 14:19:08 2009 -0700
Only read regular files
* src/transform.c (is_regular_file): new function
* src/transform.c (filter_generate): do not include non-regular files
Fixes bug #68
---
src/transform.c | 14 ++++++++++++++
1 files changed, 14 insertions(+), 0 deletions(-)
diff --git a/src/transform.c b/src/transform.c
index d7ff886..933edb4 100644
--- a/src/transform.c
+++ b/src/transform.c
@@ -101,6 +101,16 @@ static bool is_incl(struct tree *f) {
return streqv(f->label, "incl") && f->value != NULL;
}
+static bool is_regular_file(const char *path) {
+ int r;
+ struct stat st;
+
+ r = stat(path, &st);
+ if (r < 0)
+ return false;
+ return S_ISREG(st.st_mode);
+}
+
static int filter_generate(struct tree *xfm, const char *root,
int *nmatches, char ***matches) {
glob_t globbuf;
@@ -147,6 +157,10 @@ static int filter_generate(struct tree *xfm, const char *root,
include = false;
}
}
+
+ if (include)
+ include = is_regular_file(globbuf.gl_pathv[i]);
+
if (include) {
pathv[pathind] = strdup(globbuf.gl_pathv[i]);
if (pathv[pathind] == NULL)
More information about the augeas-devel
mailing list