tools/squashfs4: enable parallel builds
[openwrt/staging/jow.git] / tools / squashfs4 / patches / 004-action-rework-strdupa-with-POSIX-strdup-and-free.patch
1 From 92e628ec0e26cf091d82356e3b74f73bedf4cfc8 Mon Sep 17 00:00:00 2001
2 From: Christian Marangi <ansuelsmth@gmail.com>
3 Date: Sat, 15 Oct 2022 00:11:20 +0200
4 Subject: [PATCH] action: rework strdupa with POSIX strdup and free
5
6 strdupa is not POSIX and cause compilation error on macos.
7 Fix this by using strdup and free.
8
9 Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
10 Signed-off-by: Phillip Lougher <phillip@squashfs.org.uk>
11 ---
12 squashfs-tools/action.c | 14 +++++++++++---
13 1 file changed, 11 insertions(+), 3 deletions(-)
14
15 --- a/squashfs-tools/action.c
16 +++ b/squashfs-tools/action.c
17 @@ -2415,9 +2415,17 @@ static char *get_start(char *s, int n)
18
19 static int subpathname_fn(struct atom *atom, struct action_data *action_data)
20 {
21 - return fnmatch(atom->argv[0], get_start(strdupa(action_data->subpath),
22 - count_components(atom->argv[0])),
23 - FNM_PATHNAME|FNM_EXTMATCH) == 0;
24 + char *s, *tmp;
25 + int ret;
26 +
27 + s = tmp = strdup(action_data->subpath);
28 + tmp = get_start(tmp, count_components(atom->argv[0]));
29 +
30 + ret = fnmatch(atom->argv[0], tmp, FNM_PATHNAME|FNM_EXTMATCH);
31 +
32 + free(s);
33 +
34 + return ret == 0;
35 }
36
37 /*