aboutsummaryrefslogtreecommitdiff
path: root/bin/gensquashfs
diff options
context:
space:
mode:
Diffstat (limited to 'bin/gensquashfs')
-rw-r--r--bin/gensquashfs/Makemodule.am9
-rw-r--r--bin/gensquashfs/src/fstree_from_dir.c2
-rw-r--r--bin/gensquashfs/src/fstree_from_file.c2
-rw-r--r--bin/gensquashfs/test/fstree_from_dir.c11
-rw-r--r--bin/gensquashfs/test/fstree_from_file.c4
-rw-r--r--bin/gensquashfs/test/fstree_glob1.c9
-rw-r--r--bin/gensquashfs/test/sort_file.c4
7 files changed, 26 insertions, 15 deletions
diff --git a/bin/gensquashfs/Makemodule.am b/bin/gensquashfs/Makemodule.am
index 052f692..de9ea4c 100644
--- a/bin/gensquashfs/Makemodule.am
+++ b/bin/gensquashfs/Makemodule.am
@@ -35,7 +35,8 @@ test_fstree_from_file_SOURCES = bin/gensquashfs/test/fstree_from_file.c \
test_fstree_from_file_CPPFLAGS = $(AM_CPPFLAGS)
test_fstree_from_file_CPPFLAGS += -I$(top_srcdir)/bin/gensquashfs/src
test_fstree_from_file_CPPFLAGS += -DTESTPATH=$(GENDATADIR)/fstree1.txt
-test_fstree_from_file_LDADD = libfstree.a libio.a libutil.a libcompat.a
+test_fstree_from_file_LDADD = libcommon.a libfstree.a libio.a libutil.a \
+ libcompat.a
test_fstree_glob1_SOURCES = bin/gensquashfs/test/fstree_glob1.c \
bin/gensquashfs/src/fstree_from_file.c \
@@ -43,7 +44,7 @@ test_fstree_glob1_SOURCES = bin/gensquashfs/test/fstree_glob1.c \
bin/gensquashfs/src/mkfs.h
test_fstree_glob1_CPPFLAGS = $(AM_CPPFLAGS) -I$(top_srcdir)/bin/gensquashfs/src
test_fstree_glob1_CPPFLAGS += -DTESTPATH=$(GENDATADIR)
-test_fstree_glob1_LDADD = libfstree.a libio.a libutil.a libcompat.a
+test_fstree_glob1_LDADD = libcommon.a libfstree.a libio.a libutil.a libcompat.a
test_fstree_from_dir_SOURCES = bin/gensquashfs/test/fstree_from_dir.c \
bin/gensquashfs/src/fstree_from_dir.c \
@@ -51,7 +52,7 @@ test_fstree_from_dir_SOURCES = bin/gensquashfs/test/fstree_from_dir.c \
test_fstree_from_dir_CPPFLAGS = $(AM_CPPFLAGS)
test_fstree_from_dir_CPPFLAGS += -I$(top_srcdir)/bin/gensquashfs/src
test_fstree_from_dir_CPPFLAGS += -DTESTPATH=$(GENDATADIR)/testdir
-test_fstree_from_dir_LDADD = libfstree.a libutil.a libcompat.a
+test_fstree_from_dir_LDADD = libcommon.a libfstree.a libutil.a libcompat.a
test_sort_file_SOURCES = bin/gensquashfs/test/sort_file.c \
bin/gensquashfs/src/fstree_from_file.c \
@@ -59,7 +60,7 @@ test_sort_file_SOURCES = bin/gensquashfs/test/sort_file.c \
bin/gensquashfs/src/sort_by_file.c \
bin/gensquashfs/src/mkfs.h
test_sort_file_CPPFLAGS = $(AM_CPPFLAGS) -I$(top_srcdir)/bin/gensquashfs/src
-test_sort_file_LDADD = libfstree.a libio.a libutil.a libcompat.a
+test_sort_file_LDADD = libcommon.a libfstree.a libio.a libutil.a libcompat.a
fstree_fuzz_SOURCES = bin/gensquashfs/test/fstree_fuzz.c \
bin/gensquashfs/src/fstree_from_file.c \
diff --git a/bin/gensquashfs/src/fstree_from_dir.c b/bin/gensquashfs/src/fstree_from_dir.c
index 5b3f003..820157c 100644
--- a/bin/gensquashfs/src/fstree_from_dir.c
+++ b/bin/gensquashfs/src/fstree_from_dir.c
@@ -382,7 +382,7 @@ static int populate_dir(int dir_fd, fstree_t *fs, tree_node_t *root,
}
if (!(flags & DIR_SCAN_KEEP_TIME))
- sb.st_mtime = fs->defaults.st_mtime;
+ sb.st_mtime = fs->defaults.mtime;
if (S_ISDIR(sb.st_mode) && (flags & DIR_SCAN_NO_DIR)) {
n = fstree_get_node_by_path(fs, root, ent->d_name,
diff --git a/bin/gensquashfs/src/fstree_from_file.c b/bin/gensquashfs/src/fstree_from_file.c
index e26d4b1..d051737 100644
--- a/bin/gensquashfs/src/fstree_from_file.c
+++ b/bin/gensquashfs/src/fstree_from_file.c
@@ -507,7 +507,7 @@ static int handle_line(fstree_t *fs, const char *filename,
/* forward to callback */
memset(&sb, 0, sizeof(sb));
- sb.st_mtime = fs->defaults.st_mtime;
+ sb.st_mtime = fs->defaults.mtime;
sb.st_mode = mode | cb->mode;
sb.st_uid = uid;
sb.st_gid = gid;
diff --git a/bin/gensquashfs/test/fstree_from_dir.c b/bin/gensquashfs/test/fstree_from_dir.c
index 5e73fa4..d64934e 100644
--- a/bin/gensquashfs/test/fstree_from_dir.c
+++ b/bin/gensquashfs/test/fstree_from_dir.c
@@ -112,13 +112,16 @@ static void check_hierarchy(tree_node_t *root, bool recursive)
int main(int argc, char **argv)
{
+ fstree_defaults_t fsd;
struct stat sb;
tree_node_t *n;
fstree_t fs;
(void)argc; (void)argv;
+ TEST_ASSERT(parse_fstree_defaults(&fsd, NULL) == 0);
+
/* recursively scan into root */
- TEST_ASSERT(fstree_init(&fs, NULL) == 0);
+ TEST_ASSERT(fstree_init(&fs, &fsd) == 0);
TEST_ASSERT(fstree_from_dir(&fs, fs.root, TEST_PATH,
NULL, NULL, 0) == 0);
@@ -127,7 +130,7 @@ int main(int argc, char **argv)
fstree_cleanup(&fs);
/* non-recursively scan into root */
- TEST_ASSERT(fstree_init(&fs, NULL) == 0);
+ TEST_ASSERT(fstree_init(&fs, &fsd) == 0);
TEST_ASSERT(fstree_from_dir(&fs, fs.root, TEST_PATH, NULL, NULL,
DIR_SCAN_NO_RECURSION) == 0);
@@ -139,7 +142,7 @@ int main(int argc, char **argv)
memset(&sb, 0, sizeof(sb));
sb.st_mode = S_IFDIR | 0755;
- TEST_ASSERT(fstree_init(&fs, NULL) == 0);
+ TEST_ASSERT(fstree_init(&fs, &fsd) == 0);
n = fstree_mknode(fs.root, "foodir", 6, NULL, &sb);
TEST_NOT_NULL(n);
@@ -158,7 +161,7 @@ int main(int argc, char **argv)
memset(&sb, 0, sizeof(sb));
sb.st_mode = S_IFDIR | 0755;
- TEST_ASSERT(fstree_init(&fs, NULL) == 0);
+ TEST_ASSERT(fstree_init(&fs, &fsd) == 0);
n = fstree_mknode(fs.root, "foodir", 6, NULL, &sb);
TEST_NOT_NULL(n);
diff --git a/bin/gensquashfs/test/fstree_from_file.c b/bin/gensquashfs/test/fstree_from_file.c
index 2a9ba1e..e526f2d 100644
--- a/bin/gensquashfs/test/fstree_from_file.c
+++ b/bin/gensquashfs/test/fstree_from_file.c
@@ -11,11 +11,13 @@
int main(int argc, char **argv)
{
+ fstree_defaults_t fsd;
tree_node_t *n;
fstree_t fs;
(void)argc; (void)argv;
- TEST_ASSERT(fstree_init(&fs, NULL) == 0);
+ TEST_ASSERT(parse_fstree_defaults(&fsd, NULL) == 0);
+ TEST_ASSERT(fstree_init(&fs, &fsd) == 0);
TEST_ASSERT(fstree_from_file(&fs, TEST_PATH, NULL) == 0);
fstree_post_process(&fs);
diff --git a/bin/gensquashfs/test/fstree_glob1.c b/bin/gensquashfs/test/fstree_glob1.c
index 2d3cb80..dbe0e50 100644
--- a/bin/gensquashfs/test/fstree_glob1.c
+++ b/bin/gensquashfs/test/fstree_glob1.c
@@ -220,12 +220,15 @@ static void check_hierarchy(tree_node_t *root, bool subdir, bool recursive)
int main(int argc, char **argv)
{
+ fstree_defaults_t fsd;
fstree_t fs;
int ret;
(void)argc; (void)argv;
+ TEST_ASSERT(parse_fstree_defaults(&fsd, NULL) == 0);
+
/* first test case, directory tree only */
- ret = fstree_init(&fs, NULL);
+ ret = fstree_init(&fs, &fsd);
TEST_EQUAL_I(ret, 0);
ret = fstree_from_file(&fs, TEST_PATH "/fstree_glob1.txt", TEST_PATH);
@@ -236,7 +239,7 @@ int main(int argc, char **argv)
fstree_cleanup(&fs);
/* first test case, directory tree plus fnmatch()ed files */
- ret = fstree_init(&fs, NULL);
+ ret = fstree_init(&fs, &fsd);
TEST_EQUAL_I(ret, 0);
ret = fstree_from_file(&fs, TEST_PATH "/fstree_glob2.txt", TEST_PATH);
@@ -247,7 +250,7 @@ int main(int argc, char **argv)
fstree_cleanup(&fs);
/* third test case, same as second, but entries directly at the root */
- ret = fstree_init(&fs, NULL);
+ ret = fstree_init(&fs, &fsd);
TEST_EQUAL_I(ret, 0);
ret = fstree_from_file(&fs, TEST_PATH "/fstree_glob3.txt", TEST_PATH);
diff --git a/bin/gensquashfs/test/sort_file.c b/bin/gensquashfs/test/sort_file.c
index 6c6cce6..4b5caf8 100644
--- a/bin/gensquashfs/test/sort_file.c
+++ b/bin/gensquashfs/test/sort_file.c
@@ -150,6 +150,7 @@ static istream_t memstream = {
int main(int argc, char **argv)
{
+ fstree_defaults_t fsd;
file_info_t *fi;
fstree_t fs;
size_t i;
@@ -160,7 +161,8 @@ int main(int argc, char **argv)
memstream.buffer_offset = 0;
memstream.eof = false;
- TEST_ASSERT(fstree_init(&fs, NULL) == 0);
+ TEST_ASSERT(parse_fstree_defaults(&fsd, NULL) == 0);
+ TEST_ASSERT(fstree_init(&fs, &fsd) == 0);
TEST_ASSERT(fstree_from_file_stream(&fs, &memstream, NULL) == 0);
fstree_post_process(&fs);