From dfcb5d93c6fb3d5c1c933275622d938e83da6a70 Mon Sep 17 00:00:00 2001 From: David Oberhollenzer Date: Mon, 10 Jun 2019 00:28:55 +0200 Subject: gensquashfs: do pushd/popd when needed instead of chdir This commit replaces the chdir to the input directory with pushd/popd when building the fstree and again when packing files. This simplifies handling of other file paths given on the command line that have to be accessed and are relative to the original working directories. Signed-off-by: David Oberhollenzer --- include/fstree.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'include') diff --git a/include/fstree.h b/include/fstree.h index 33fa8b8..3c9e2af 100644 --- a/include/fstree.h +++ b/include/fstree.h @@ -222,7 +222,10 @@ void fstree_xattr_deduplicate(fstree_t *fs); Parses the file format accepted by gensquashfs and produce a file system tree from it. File input paths are interpreted as relative to the given root dir. If rootdir is NULL, use the path where the input file is as root - dir. The function actually chdirs into the root dir. + dir. + + This function tries to temporarily change the working directory, so if it + fails, the current working directory is undefined. On failure, an error report with filename and line number is written to stderr. -- cgit v1.2.3