From 3f8ad12b92be3183e457def7c790291a7fb0d08b Mon Sep 17 00:00:00 2001 From: Frederic Germain Date: Tue, 9 Nov 2021 08:17:49 +0000 Subject: Fix warning about unaligned pointer in jffs2reader MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 Signed-off-by: David Oberhollenzer --- jffsX-utils/jffs2reader.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'jffsX-utils') 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)), -- cgit v1.2.3