Worked around inconsistency of stat.st_rdev and dev_t on Debian mips, mipsel

This commit is contained in:
Thomas Schmitt 2011-11-24 09:32:30 +00:00
parent 6a5fead882
commit 3411e4dfd5
2 changed files with 11 additions and 2 deletions

View File

@ -225,6 +225,7 @@ int Xorriso_fake_stbuf(struct XorrisO *xorriso, char *path, struct stat *stbuf,
uint32_t lba; uint32_t lba;
char *catcontent = NULL; char *catcontent = NULL;
off_t catsize; off_t catsize;
dev_t dev_number;
memset((char *) stbuf, 0, sizeof(struct stat)); memset((char *) stbuf, 0, sizeof(struct stat));
if(!(flag&1)) { 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); Xorriso_node_get_dev(xorriso, *node, path, &(stbuf->st_rdev), 0);
} else if(LIBISO_ISBLK(*node)) { } else if(LIBISO_ISBLK(*node)) {
stbuf->st_mode|= S_IFBLK; 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)) } else if(LIBISO_ISFIFO(*node))
stbuf->st_mode|= S_IFIFO; stbuf->st_mode|= S_IFIFO;
else if(LIBISO_ISSOCK(*node)) else if(LIBISO_ISSOCK(*node))

View File

@ -1 +1 @@
#define Xorriso_timestamP "2011.11.21.081802" #define Xorriso_timestamP "2011.11.24.093151"