From eb56a6152e71a92f321be45a421855afbb34d753 Mon Sep 17 00:00:00 2001 From: Thomas Schmitt Date: Thu, 24 Nov 2011 09:32:30 +0000 Subject: [PATCH] Worked around inconsistency of stat.st_rdev and dev_t on Debian mips, mipsel --- xorriso/iso_tree.c | 11 ++++++++++- xorriso/xorriso_timestamp.h | 2 +- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/xorriso/iso_tree.c b/xorriso/iso_tree.c index 7f8eb89d..165ec417 100644 --- a/xorriso/iso_tree.c +++ b/xorriso/iso_tree.c @@ -225,6 +225,7 @@ int Xorriso_fake_stbuf(struct XorrisO *xorriso, char *path, struct stat *stbuf, uint32_t lba; char *catcontent = NULL; off_t catsize; + dev_t dev_number; memset((char *) stbuf, 0, sizeof(struct stat)); if(!(flag&1)) { @@ -256,7 +257,15 @@ int Xorriso_fake_stbuf(struct XorrisO *xorriso, char *path, struct stat *stbuf, Xorriso_node_get_dev(xorriso, *node, path, &(stbuf->st_rdev), 0); } else if(LIBISO_ISBLK(*node)) { stbuf->st_mode|= S_IFBLK; - Xorriso_node_get_dev(xorriso, *node, path, &(stbuf->st_rdev), 0); + /* ts B11124: + Debian mips and mipsel have sizeof(stbuf.st_rdev) == 4 + whereas sizeof(dev_t) is 8. + This workaround assumes that the returned numbers fit into 4 bytes. + The may stem from the local filesystem or from the ISO image. + At least there will be no memory corruption but only an integer rollover. + */ + Xorriso_node_get_dev(xorriso, *node, path, &dev_number, 0); + stbuf->st_rdev= dev_number; } else if(LIBISO_ISFIFO(*node)) stbuf->st_mode|= S_IFIFO; else if(LIBISO_ISSOCK(*node)) diff --git a/xorriso/xorriso_timestamp.h b/xorriso/xorriso_timestamp.h index 81595e3c..d2d8c982 100644 --- a/xorriso/xorriso_timestamp.h +++ b/xorriso/xorriso_timestamp.h @@ -1 +1 @@ -#define Xorriso_timestamP "2011.11.21.081802" +#define Xorriso_timestamP "2011.11.24.093151"