From c4b2a882a539ef2b33a8d4efcff09d4aad48e196 Mon Sep 17 00:00:00 2001 From: Richard Maw Date: Wed, 19 Oct 2011 17:30:28 +0100 Subject: mtime is now a time_t rather than a uint32_t In future it should be standardised so that diffs can be made on a different architecture to the one they are deployed on, but currently it doesn't work on the same architecture if that architecture is 64-bit --- libtbd_apply.c | 28 ++++++++++++++-------------- libtbd_create.c | 4 ++-- libtbd_stat.c | 2 +- libtbd_stat.h | 2 +- 4 files changed, 18 insertions(+), 18 deletions(-) diff --git a/libtbd_apply.c b/libtbd_apply.c index 53ac06b..4bf13ca 100644 --- a/libtbd_apply.c +++ b/libtbd_apply.c @@ -117,8 +117,8 @@ tbd_apply_cmd_dir_create(FILE *stream) if(strchr(dname, '/') != NULL) return TBD_ERROR(TBD_ERROR_INVALID_PARAMETER); - uint32_t mtime; - if(fread(&mtime, sizeof(uint32_t), 1, stream) != 1) + time_t mtime; + if(fread(&mtime, sizeof(mtime), 1, stream) != 1) return TBD_ERROR(TBD_ERROR_UNABLE_TO_READ_STREAM); uint32_t uid; @@ -215,13 +215,13 @@ tbd_apply_cmd_file_create(FILE *stream) if((strchr(fname, '/') != NULL) || (strcmp(fname, "..") == 0)) return TBD_ERROR(TBD_ERROR_INVALID_PARAMETER); - uint32_t mtime; + time_t mtime; uint32_t mode; uint32_t uid; uint32_t gid; uint32_t fsize; - if(fread(&mtime, sizeof(uint32_t), 1, stream) != 1 || + if(fread(&mtime, sizeof(mtime), 1, stream) != 1 || fread(&mode, sizeof(uint32_t), 1, stream) != 1 || fread(&uid, sizeof(uint32_t), 1, stream) != 1 || fread(&gid, sizeof(uint32_t), 1, stream) != 1 || @@ -268,7 +268,7 @@ static int tbd_apply_cmd_file_delta(FILE *stream) { uint16_t mdata_mask; - uint32_t mtime; + time_t mtime; uint32_t uid; uint32_t gid; uint32_t mode; @@ -288,7 +288,7 @@ tbd_apply_cmd_file_delta(FILE *stream) /* Reading metadata */ if(fread(&mdata_mask, sizeof(uint16_t), 1, stream) != 1 || - fread(&mtime, sizeof(uint32_t), 1, stream) != 1 || + fread(&mtime, sizeof(mtime), 1, stream) != 1 || fread(&uid, sizeof(uint32_t), 1, stream) != 1 || fread(&gid, sizeof(uint32_t), 1, stream) != 1 || fread(&mode, sizeof(uint32_t), 1, stream) != 1) @@ -458,11 +458,11 @@ static int tbd_apply_cmd_symlink_create(FILE *stream) { uint16_t len; - uint32_t mtime; + time_t mtime; uint32_t uid; uint32_t gid; - if(fread(&mtime, sizeof(uint32_t), 1, stream) != 1 || + if(fread(&mtime, sizeof(mtime), 1, stream) != 1 || fread(&uid, sizeof(uint32_t), 1, stream) != 1 || fread(&gid, sizeof(uint32_t), 1, stream) != 1) return TBD_ERROR(TBD_ERROR_UNABLE_TO_READ_STREAM); @@ -505,14 +505,14 @@ static int tbd_apply_cmd_special_create(FILE *stream) { char *name = tbd_apply_fread_string(stream); - uint32_t mtime; + time_t mtime; uint32_t mode; uint32_t uid; uint32_t gid; uint32_t dev; if(name == NULL || - fread(&mtime, sizeof(uint32_t), 1, stream) != 1 || + fread(&mtime, sizeof(mtime), 1, stream) != 1 || fread(&mode, sizeof(uint32_t), 1, stream) != 1 || fread(&uid, sizeof(uint32_t), 1, stream) != 1 || fread(&gid, sizeof(uint32_t), 1, stream) != 1 || @@ -542,13 +542,13 @@ static int tbd_apply_cmd_dir_delta(FILE *stream) { uint16_t metadata_mask; - uint32_t mtime; + time_t mtime; uint32_t uid; uint32_t gid; uint32_t mode; if(fread(&metadata_mask, sizeof(uint16_t), 1, stream) != 1 || - fread(&mtime, sizeof(uint32_t), 1, stream) != 1 || + fread(&mtime, sizeof(mtime), 1, stream) != 1 || fread(&uid, sizeof(uint32_t), 1, stream) != 1 || fread(&gid, sizeof(uint32_t), 1, stream) != 1 || fread(&mode, sizeof(uint32_t), 1, stream) != 1) @@ -577,13 +577,13 @@ static int tbd_apply_cmd_file_mdata_update(FILE *stream) { uint16_t metadata_mask; - uint32_t mtime; + time_t mtime; uint32_t uid; uint32_t gid; uint32_t mode; if(fread(&metadata_mask, sizeof(uint16_t), 1, stream) != 1 || - fread(&mtime, sizeof(uint32_t), 1, stream) != 1 || + fread(&mtime, sizeof(mtime), 1, stream) != 1 || fread(&uid, sizeof(uint32_t), 1, stream) != 1 || fread(&gid, sizeof(uint32_t), 1, stream) != 1 || fread(&mode, sizeof(uint32_t), 1, stream) != 1) diff --git a/libtbd_create.c b/libtbd_create.c index f1d886d..5f0bef0 100644 --- a/libtbd_create.c +++ b/libtbd_create.c @@ -76,9 +76,9 @@ tbd_create_fwrite_mdata_mask(FILE *stream, static int tbd_create_fwrite_mtime(FILE *stream, - uint32_t mtime) + time_t mtime) { - if(fwrite(&mtime, sizeof(uint32_t), 1, stream) != 1) + if(fwrite(&mtime, sizeof(mtime), 1, stream) != 1) return TBD_ERROR(TBD_ERROR_UNABLE_TO_WRITE_STREAM); return 0; } diff --git a/libtbd_stat.c b/libtbd_stat.c index dacbe12..a8e0a33 100644 --- a/libtbd_stat.c +++ b/libtbd_stat.c @@ -91,7 +91,7 @@ tbd_stat_from_path(const char *name, ret->uid = (uint32_t)info.st_uid; ret->gid = (uint32_t)info.st_gid; ret->mode = (uint32_t)info.st_mode; - ret->mtime = (uint32_t)info.st_mtime; + ret->mtime = (time_t)info.st_mtime; return ret; } diff --git a/libtbd_stat.h b/libtbd_stat.h index f375ab1..f71337f 100644 --- a/libtbd_stat.h +++ b/libtbd_stat.h @@ -37,7 +37,7 @@ typedef struct { void* parent; char* name; tbd_stat_type_e type; - uint32_t mtime; + time_t mtime; uint32_t size; // Count for directory. uint32_t uid; uint32_t gid; -- cgit v1.2.1