aboutsummaryrefslogtreecommitdiffstats
path: root/tools/squashfs4/patches/004-action-rework-strdupa-with-POSIX-strdup-and-free.patch
diff options
context:
space:
mode:
authorChristian Marangi <ansuelsmth@gmail.com>2023-02-06 23:22:43 +0100
committerChristian Marangi <ansuelsmth@gmail.com>2023-02-20 07:34:03 +0100
commit30f2d516ba7be08f06f7ca8767472c3ea5678706 (patch)
tree6a76fef0e685764abd5f3ed2df2ebcce7856b219 /tools/squashfs4/patches/004-action-rework-strdupa-with-POSIX-strdup-and-free.patch
parent57db2280a2155c39f545ac712766a849cf45f62c (diff)
downloadupstream-30f2d516ba7be08f06f7ca8767472c3ea5678706.tar.gz
upstream-30f2d516ba7be08f06f7ca8767472c3ea5678706.tar.bz2
upstream-30f2d516ba7be08f06f7ca8767472c3ea5678706.zip
tools/squashfs4: add new tool for squashfs4 images
squashfs tool is finally reborn and correctly maintained. Introduce the new version as a replacement for squasfs4kit as it was a fork and also abandoned. Add additional patch to add the missing feature present in squashfskit4 but still missing on this new project. Backport each required patch that fix compilation error on macos. Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
Diffstat (limited to 'tools/squashfs4/patches/004-action-rework-strdupa-with-POSIX-strdup-and-free.patch')
-rw-r--r--tools/squashfs4/patches/004-action-rework-strdupa-with-POSIX-strdup-and-free.patch37
1 files changed, 37 insertions, 0 deletions
diff --git a/tools/squashfs4/patches/004-action-rework-strdupa-with-POSIX-strdup-and-free.patch b/tools/squashfs4/patches/004-action-rework-strdupa-with-POSIX-strdup-and-free.patch
new file mode 100644
index 0000000000..3d6f696c8e
--- /dev/null
+++ b/tools/squashfs4/patches/004-action-rework-strdupa-with-POSIX-strdup-and-free.patch
@@ -0,0 +1,37 @@
+From 92e628ec0e26cf091d82356e3b74f73bedf4cfc8 Mon Sep 17 00:00:00 2001
+From: Christian Marangi <ansuelsmth@gmail.com>
+Date: Sat, 15 Oct 2022 00:11:20 +0200
+Subject: [PATCH] action: rework strdupa with POSIX strdup and free
+
+strdupa is not POSIX and cause compilation error on macos.
+Fix this by using strdup and free.
+
+Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
+Signed-off-by: Phillip Lougher <phillip@squashfs.org.uk>
+---
+ squashfs-tools/action.c | 14 +++++++++++---
+ 1 file changed, 11 insertions(+), 3 deletions(-)
+
+--- a/squashfs-tools/action.c
++++ b/squashfs-tools/action.c
+@@ -2415,9 +2415,17 @@ static char *get_start(char *s, int n)
+
+ static int subpathname_fn(struct atom *atom, struct action_data *action_data)
+ {
+- return fnmatch(atom->argv[0], get_start(strdupa(action_data->subpath),
+- count_components(atom->argv[0])),
+- FNM_PATHNAME|FNM_EXTMATCH) == 0;
++ char *s, *tmp;
++ int ret;
++
++ s = tmp = strdup(action_data->subpath);
++ tmp = get_start(tmp, count_components(atom->argv[0]));
++
++ ret = fnmatch(atom->argv[0], tmp, FNM_PATHNAME|FNM_EXTMATCH);
++
++ free(s);
++
++ return ret == 0;
+ }
+
+ /*