summaryrefslogtreecommitdiff
path: root/unpack/restore_fstree.c
AgeCommit message (Collapse)Author
2019-08-19Fix chmod of symlinks in restore_fstreeDavid Oberhollenzer
We can't change the mod of symlinks and hence AT_SYMLINK_NOFOLLOW is not supported by chmod(2 -> RTFM!). The solution is to not use that flag and simply skip symlinks. Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
2019-08-19Fix directory traversal in update_tree_attribsDavid Oberhollenzer
Do not try to change the nameless root node which is mapped to the output directory. Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
2019-08-19Add rdsquashfs flag to restore file timestampsDavid Oberhollenzer
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
2019-08-04Fix functions with side effect being used inside assertsDavid Oberhollenzer
If -DNDEBUG is set, the entire thing is omitted from the output. Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
2019-08-01Add flag to rdsquashfs to optionally set xattrs on unpacked filesDavid Oberhollenzer
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
2019-07-30Add propper copyright headers to all source filesDavid Oberhollenzer
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
2019-07-25Add assertion around canonicalize_name in rdsquashfsDavid Oberhollenzer
The names generated by fstree are always in the correct format, but this is still needed for the sake of documentation and to guide static analysis tools. Should canonicalize_name fail on an fstree generated name, something is serverly broken. Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
2019-07-25rdsquashfs: seperate creating of the hierarchy, unpacking and chmod/chownDavid Oberhollenzer
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
2019-07-25cleanup: remove some redundant header inclusionsDavid Oberhollenzer
The utility programs pretty much all have the same structure of including one central header per C file that includes all required library headers, so we can simply include config.h which we need for large file support from there and remove it from the C files. Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
2019-07-24Enable largefile supportMatt Turner
Requires that config.h be included before other headers, since the macro _FILE_OFFSET_BITS changes the definitions of things like 'struct stat'. I chose to simply include it at the top of every C file and at immediately after the double-inclusion guards of every header. Signed-off-by: Matt Turner <mattst88@gmail.com> Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
2019-07-01Fix null-pointer dereference in restore_unpackDavid Oberhollenzer
Use a seperate variable to iterate over directory children and don't modify n. Otherwise, the chown/chmod code below derefernces a null pointer when trying to access n->name, n->uid and n->gid. Bug found using scan-build. Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
2019-06-28Add support for unpacking sparse files as sparse filesDavid Oberhollenzer
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
2019-06-11cleanup: get rid of unsqfs_info_tDavid Oberhollenzer
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
2019-06-11Move file extraction code to generic data_reader_t in libsquashfs.aDavid Oberhollenzer
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
2019-06-11cleanup: simplify rdsquashfs unpacking: use existing utility functionsDavid Oberhollenzer
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
2019-05-05rdsquashfs: reorder unpack flags, add flag to produce listingDavid Oberhollenzer
The listing command has been used successfully to do the following: - generate a prestine file system using gensquashfs - repeate multiple times: - generate a listing from the file system - unpack only the regular files from the file system - generate a new file system from the listing - run `diff` on the old and new filesystem and admire that they are identical - replace the old file system with the new one, since they are identical Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
2019-05-05Print out what we are doing on the way and options to keep quietDavid Oberhollenzer
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
2019-05-04cleanup: rdsquashfs: store global data in structureDavid Oberhollenzer
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
2019-05-04rdsquashfs: add ability to unpack only a sub tree of the file systemDavid Oberhollenzer
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
2019-05-04Rename tools to not collide with squashfs-toolsDavid Oberhollenzer
This commit changes the names of the tools to gensquashfs and rdsquashfs so they don't collide with the names used by the squashfs-tools package and the two can be installed side by side. Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
2019-05-03unsquashfs: add flags to filter what file types to unpackDavid Oberhollenzer
This allows the user to skip stuff like device special files (which non-root can't create anyway) or to not create symlinks/fifos etc... Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
2019-05-03unsquashfs: add code to unpack the entire file systemDavid Oberhollenzer
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>