aboutsummaryrefslogtreecommitdiff
path: root/core/recipes-extended/ltp/ltp/0040-fs-read_all-define-FNM_EXTMATCH-if-needed.patch
blob: 7310472df40cb3a3e75a151744b4108d09474362 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
From 822ad20433799193e2180862137c36f24e5d27d6 Mon Sep 17 00:00:00 2001
From: Rafael David Tinoco <rafael.tinoco@linaro.org>
Date: Tue, 28 Aug 2018 14:16:54 -0300
Subject: [PATCH] fs/read_all: define FNM_EXTMATCH if needed
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

FNM_EXTMATCH is not defined in musl libc:

| read_all.c: In function 'read_test':
| read_all.c:201:41: error: 'FNM_EXTMATCH' undeclared (first use in this function); did you mean 'FNM_NOMATCH'?
|   if (exclude && !fnmatch(exclude, path, FNM_EXTMATCH)) {
|                                          ^~~~~~~~~~~~
|                                          FNM_NOMATCH
| read_all.c:201:41: note: each undeclared identifier is reported only once for each function it appears in
| <builtin>: recipe for target 'read_all' failed
| make[4]: *** [read_all] Error 1

Even not being 100% musl ready at the moment, this seems a trivial fix
to allow LTP to be built with musl libc.

Signed-off-by: Daniel Díaz <daniel.diaz@linaro.org>
Signed-off-by: Rafael David Tinoco <rafael.tinoco@linaro.org>
Tested-by: Daniel Díaz <daniel.diaz@linaro.org>
Acked-by: Cyril Hrubis <chrubis@suse.cz>
---
 include/lapi/fnmatch.h                  | 14 ++++++++++++++
 testcases/kernel/fs/read_all/read_all.c |  1 +
 2 files changed, 15 insertions(+)
 create mode 100644 include/lapi/fnmatch.h

diff --git a/include/lapi/fnmatch.h b/include/lapi/fnmatch.h
new file mode 100644
index 0000000..9628ac4
--- /dev/null
+++ b/include/lapi/fnmatch.h
@@ -0,0 +1,14 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
+/*
+ * Copyright (c) 2018 Linaro Limited. All rights reserved.
+ * Author: Rafael David Tinoco <rafael.tinoco@linaro.org>
+ */
+
+#ifndef FNMATCH_H__
+#define FNMATCH_H__
+
+#ifndef FNM_EXTMATCH
+#define FNM_EXTMATCH 0
+#endif
+
+#endif
diff --git a/testcases/kernel/fs/read_all/read_all.c b/testcases/kernel/fs/read_all/read_all.c
index ac463db..1f0b315 100644
--- a/testcases/kernel/fs/read_all/read_all.c
+++ b/testcases/kernel/fs/read_all/read_all.c
@@ -40,6 +40,7 @@
  */
 #include <sys/types.h>
 #include <sys/stat.h>
+#include <lapi/fnmatch.h>
 #include <stdlib.h>
 #include <stdio.h>
 #include <dirent.h>
-- 
2.7.4