summaryrefslogtreecommitdiff
path: root/metaentry.c
diff options
context:
space:
mode:
authorDavid Härdeman <david@hardeman.nu>2008-03-20 14:25:47 +0100
committerDavid Härdeman <david@hardeman.nu>2008-03-20 14:25:47 +0100
commit2d6671c648942d46522fc53c5cff2142d4572eeb (patch)
treeb329bb025ab3501a83bc8ff3030fcf07e5ab2a05 /metaentry.c
parent84e8f95743199deec9db0a87da517252af3cd6d8 (diff)
First stab at supporting the option of automatically creating empty
directories which are missing. This should help with Debian BR #460998
Diffstat (limited to 'metaentry.c')
-rw-r--r--metaentry.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/metaentry.c b/metaentry.c
index efd8d3a..c06fd3d 100644
--- a/metaentry.c
+++ b/metaentry.c
@@ -175,7 +175,7 @@ mentries_print(const struct metahash *mhash)
#endif
/* Creates a metaentry for the file/dir/etc at path */
-static struct metaentry *
+struct metaentry *
mentry_create(const char *path)
{
ssize_t lsize, vsize;
@@ -208,6 +208,7 @@ mentry_create(const char *path)
mentry = mentry_alloc();
mentry->path = xstrdup(path);
+ mentry->pathlen = strlen(mentry->path);
mentry->owner = xstrdup(pbuf->pw_name);
mentry->group = xstrdup(gbuf->gr_name);
mentry->mode = sbuf.st_mode & 0177777;
@@ -473,6 +474,7 @@ mentries_fromfile(struct metahash **mhash, const char *path)
mentry = mentry_alloc();
mentry->path = read_string(&ptr, max);
+ mentry->pathlen = strlen(mentry->path);
mentry->owner = read_string(&ptr, max);
mentry->group = read_string(&ptr, max);
mentry->mtime = (time_t)read_int(&ptr, 8, max);
@@ -549,8 +551,8 @@ mentry_compare_xattr(struct metaentry *left, struct metaentry *right)
}
/* Compares two metaentries and returns an int with a bitmask of differences */
-static int
-mentry_compare(struct metaentry *left, struct metaentry *right, int do_mtime)
+int
+mentry_compare(struct metaentry *left, struct metaentry *right, bool do_mtime)
{
int retval = DIFF_NONE;
@@ -592,8 +594,8 @@ void
mentries_compare(struct metahash *mhashreal,
struct metahash *mhashstored,
void (*pfunc)
- (struct metaentry *real, struct metaentry *stored, int do_mtime),
- int do_mtime)
+ (struct metaentry *real, struct metaentry *stored, int cmp),
+ bool do_mtime)
{
struct metaentry *real, *stored;
int key;