summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFrederic Germain <frederic.germain@gmail.com>2021-11-09 08:17:49 +0000
committerDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>2022-10-07 12:58:44 +0200
commit3f8ad12b92be3183e457def7c790291a7fb0d08b (patch)
tree268bbccbfd82601ff4d40de0b89b867826362304
parentd798e9168cb0efe8883fb77a97fc893a210acf01 (diff)
Fix warning about unaligned pointer in jffs2reader
gcc 9.3.0-17ubuntu1~20.04 warning on time_t ctime value is : Fix taking address of packed member of ‘struct jffs2_raw_inode’ may result in an unaligned pointer value [-Waddress-of-packed-member]. Signed-off-by: Frederic Germain <frederic.germain@gmail.com> Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
-rw-r--r--jffsX-utils/jffs2reader.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/jffsX-utils/jffs2reader.c b/jffsX-utils/jffs2reader.c
index 083500e..33c5577 100644
--- a/jffsX-utils/jffs2reader.c
+++ b/jffsX-utils/jffs2reader.c
@@ -336,8 +336,9 @@ static void printdir(char *o, size_t size, struct dir *d, const char *path,
d = d->next;
continue;
}
-
- filetime = ctime((const time_t *) &(ri->ctime));
+ time_t _ctime;
+ memcpy(&_ctime, &(ri->ctime), sizeof(time_t));
+ filetime = ctime(&_ctime);
age = time(NULL) - je32_to_cpu(ri->ctime);
mode.v32 = ri->mode.m;
printf("%s %-4d %-8d %-8d ", mode_string(je32_to_cpu(mode)),