summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlberto Ruiz <alberto.ruiz@codethink.co.uk>2011-09-28 12:45:30 +0100
committerAlberto Ruiz <alberto.ruiz@codethink.co.uk>2011-09-28 12:45:30 +0100
commite026d3decb04844e341bd4f94b80f2e77d8ea383 (patch)
treed04cf1822d2793e4c7db505553405c9509bc4968
parentd5de74f8ddbaba31ca5dd42efbbcf6948704048a (diff)
downloadtbdiff-e026d3decb04844e341bd4f94b80f2e77d8ea383.tar.gz
Directory permission/ownership delta implemented
-rw-r--r--otap_apply.c8
-rw-r--r--otap_create.c13
2 files changed, 11 insertions, 10 deletions
diff --git a/otap_apply.c b/otap_apply.c
index ccabae6..b47526e 100644
--- a/otap_apply.c
+++ b/otap_apply.c
@@ -111,6 +111,7 @@ _otap_apply_cmd_dir_enter(FILE *stream,
otap_error(OTAP_ERROR_UNABLE_TO_CHANGE_DIR);
if(depth != NULL)
(*depth)++;
+
if(chdir(dname) != 0)
otap_error(OTAP_ERROR_UNABLE_TO_CHANGE_DIR);
return 0;
@@ -463,8 +464,7 @@ _otap_apply_cmd_special_create(FILE *stream)
static int
_otap_apply_cmd_dir_delta(FILE *stream)
-{
-
+{
uint16_t metadata_mask;
if(fread(&metadata_mask, sizeof(uint16_t), 1, stream) != 1)
otap_error(OTAP_ERROR_UNABLE_TO_READ_STREAM);
@@ -487,6 +487,10 @@ _otap_apply_cmd_dir_delta(FILE *stream)
int ret;
char *dname = _otap_apply_fread_string(stream);
+ if (dname == NULL)
+ otap_error(OTAP_ERROR_UNABLE_TO_READ_STREAM);
+
+ fprintf(stderr, "cmd_special_delta %s\n", dname);
if (metadata_mask & OTAP_METADATA_MTIME)
{
diff --git a/otap_create.c b/otap_create.c
index 745d413..29ac777 100644
--- a/otap_create.c
+++ b/otap_create.c
@@ -416,14 +416,14 @@ _otap_create_cmd_dir_delta (FILE *stream,
/* If nothing changes we issue no command */
if (a->mtime == b->mtime)
- metadata_mask &= OTAP_METADATA_MTIME;
+ metadata_mask |= OTAP_METADATA_MTIME;
if (a->uid == b->uid)
- metadata_mask &= OTAP_METADATA_UID;
+ metadata_mask |= OTAP_METADATA_UID;
if (a->gid == b->gid)
- metadata_mask &= OTAP_METADATA_GID;
+ metadata_mask |= OTAP_METADATA_GID;
if (a->mode == b->mode)
- metadata_mask &= OTAP_METADATA_MODE;
-
+ metadata_mask |= OTAP_METADATA_MODE;
+
if (metadata_mask == OTAP_METADATA_NONE)
return 0;
@@ -567,7 +567,6 @@ _otap_create (FILE *stream,
if((a == NULL) || ((b != NULL) && (a->type != b->type)))
{
- printf ("foo\n");
switch(b->type)
{
case OTAP_STAT_TYPE_FILE:
@@ -615,8 +614,6 @@ _otap_create (FILE *stream,
if(_b == NULL)
otap_error(OTAP_ERROR_UNABLE_TO_STAT_FILE);
otap_stat_t* _a = otap_stat_entry_find(a, _b->name);
- fprintf (stderr, "%p - %p\n", _a, _b);
- fprintf (stderr, "%s - %s\n", _a->name, _b->name);
err = _otap_create(stream, _a, _b, false);
otap_stat_free(_a);
otap_stat_free(_b);