diff --git a/libisofs/builder.c b/libisofs/builder.c index 547da40..9635892 100644 --- a/libisofs/builder.c +++ b/libisofs/builder.c @@ -92,6 +92,7 @@ int default_create_node(IsoNodeBuilder *builder, IsoImage *image, int ret; struct stat info; IsoNode *new; + IsoFilesystem *fs; char *name; unsigned char *aa_string; char *a_text = NULL, *d_text = NULL; @@ -111,6 +112,7 @@ int default_create_node(IsoNodeBuilder *builder, IsoImage *image, } name = iso_file_source_get_name(src); + fs = iso_file_source_get_filesystem(src); new = NULL; switch (info.st_mode & S_IFMT) { @@ -154,6 +156,13 @@ int default_create_node(IsoNodeBuilder *builder, IsoImage *image, } ret = iso_node_new_symlink(name, strdup(dest), &link); new = (IsoNode*) link; + if (fs != NULL) { + link->fs_id = fs->get_id(fs); + if (link->fs_id != 0) { + link->st_ino = info.st_ino; + link->st_dev = info.st_dev; + } + } } break; case S_IFSOCK: @@ -166,6 +175,13 @@ int default_create_node(IsoNodeBuilder *builder, IsoImage *image, ret = iso_node_new_special(name, info.st_mode, info.st_rdev, &special); new = (IsoNode*) special; + if (fs != NULL) { + special->fs_id = fs->get_id(fs); + if (special->fs_id != 0) { + special->st_ino = info.st_ino; + special->st_dev = info.st_dev; + } + } } break; } diff --git a/libisofs/node.c b/libisofs/node.c index d30a1fc..68e2600 100644 --- a/libisofs/node.c +++ b/libisofs/node.c @@ -2279,6 +2279,8 @@ int iso_node_get_id(IsoNode *node, unsigned int *fs_id, dev_t *dev_id, { int ret; IsoFile *file; + IsoSymlink *symlink; + IsoSpecial *special; void *xipt; ret = iso_node_get_xinfo(node, iso_px_ino_xinfo_func, &xipt); @@ -2302,7 +2304,25 @@ int iso_node_get_id(IsoNode *node, unsigned int *fs_id, dev_t *dev_id, #ifdef Libisofs_hardlink_matcheR - /* >>> check for id tuples of LIBISO_SYMLINK and LIBISO_SPECIAL */; + } else if (node->type == LIBISO_SYMLINK) { + symlink = (IsoSymlink *) node; + if (symlink->fs_id != ISO_IMAGE_FS_ID && (flag & 1)) { + ret = 0; + goto no_id; + } + *fs_id = symlink->fs_id; + *dev_id = symlink->st_dev; + *ino_id = symlink->st_ino; + + } else if (node->type == LIBISO_SPECIAL) { + special = (IsoSpecial *) node; + if (special->fs_id != ISO_IMAGE_FS_ID && (flag & 1)) { + ret = 0; + goto no_id; + } + *fs_id = special->fs_id; + *dev_id = special->st_dev; + *ino_id = special->st_ino; #endif @@ -2344,6 +2364,8 @@ int iso_node_set_ino(IsoNode *node, ino_t ino, int flag) { int ret; IsoFile *file; + IsoSymlink *symlink; + IsoSpecial *special; void *xipt; ret = iso_node_get_xinfo(node, iso_px_ino_xinfo_func, &xipt); @@ -2363,8 +2385,19 @@ int iso_node_set_ino(IsoNode *node, ino_t ino, int flag) #ifdef Libisofs_hardlink_matcheR - /* >>> check for id tuples of LIBISO_SYMLINK and LIBISO_SPECIAL : - if fs_id = ISO_IMAGE_FS_ID then overwite .st_ino */; + } else if (node->type == LIBISO_SYMLINK) { + symlink = (IsoSymlink *) node; + if (symlink->fs_id == ISO_IMAGE_FS_ID) { + symlink->st_ino = ino; + return 1; + } + + } else if (node->type == LIBISO_SPECIAL) { + special = (IsoSpecial *) node; + if (special->fs_id == ISO_IMAGE_FS_ID) { + special->st_ino = ino; + return 1; + } #endif