summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrei Gherzan <andrei@gherzan.ro>2012-07-17 13:39:26 +0000
committerRichard Purdie <richard.purdie@linuxfoundation.org>2012-07-19 17:18:10 +0100
commit9d8387170ca37561ba1bedfa73b2b3eaf5f8c6bf (patch)
treee33a7e5fb3204b396c95e0c24603ac3ecf977cfc
parent8e0f5026fd659e4fc718b8140f01716a4a3294bb (diff)
downloadpoky-9d8387170ca37561ba1bedfa73b2b3eaf5f8c6bf.tar.gz
connman: Add patches to fix connman on fs with no d_type support
When there is not d_type avalaible on filesystem, fstatat (stat) can be used to check if the path is a directory. storage.c and timezone.c were modified accordingly. (From OE-Core rev: 09203299c666791ce35d5a897fd1aa2b0d281dd6) Signed-off-by: Andrei Gherzan <andrei.gherzan@windriver.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r--meta/recipes-connectivity/connman/connman/0001-timezone.c-If-there-is-no-d_type-support-use-fstatat.patch61
-rw-r--r--meta/recipes-connectivity/connman/connman/0002-storage.c-If-there-is-no-d_type-support-use-fstatat.patch49
-rw-r--r--meta/recipes-connectivity/connman/connman_1.3.bb6
3 files changed, 114 insertions, 2 deletions
diff --git a/meta/recipes-connectivity/connman/connman/0001-timezone.c-If-there-is-no-d_type-support-use-fstatat.patch b/meta/recipes-connectivity/connman/connman/0001-timezone.c-If-there-is-no-d_type-support-use-fstatat.patch
new file mode 100644
index 0000000000..3bced52054
--- /dev/null
+++ b/meta/recipes-connectivity/connman/connman/0001-timezone.c-If-there-is-no-d_type-support-use-fstatat.patch
@@ -0,0 +1,61 @@
1From f2094e6b2e4542adf458d8fa58d7bccd5edb762e Mon Sep 17 00:00:00 2001
2From: Andrei Gherzan <andrei@gherzan.ro>
3Date: Tue, 17 Jul 2012 17:27:39 +0300
4Subject: [PATCH V3 1/2] timezone.c: If there is no d_type support use
5 fstatat()
6
7This is useful for filesystems where d_type is always DT_UNKNOWN.
8In this case use fstatat() function.
9
10Signed-off-by: Andrei Gherzan <andrei.gherzan@windriver.com>
11Upstream-Status: Submitted
12
13---
14 src/timezone.c | 24 ++++++++++++++++++++++++
15 1 file changed, 24 insertions(+)
16
17diff --git a/src/timezone.c b/src/timezone.c
18index 173d658..f951f6b 100644
19--- a/src/timezone.c
20+++ b/src/timezone.c
21@@ -157,6 +157,8 @@ static char *find_origin(void *src_map, struct stat *src_st,
22 DIR *dir;
23 struct dirent *d;
24 char *str, pathname[PATH_MAX];
25+ struct stat buf;
26+ int ret;
27
28 if (subpath == NULL)
29 strncpy(pathname, basepath, sizeof(pathname));
30@@ -205,6 +207,28 @@ static char *find_origin(void *src_map, struct stat *src_st,
31 return str;
32 }
33 break;
34+ case DT_UNKNOWN:
35+ /*
36+ * If there is no d_type support use fstatat()
37+ * to check if directory
38+ */
39+ ret = fstatat(dirfd(dir), d->d_name, &buf, 0);
40+ if (ret < 0)
41+ continue;
42+ if (!(buf.st_mode & S_IFDIR))
43+ continue;
44+ if (subpath == NULL)
45+ strncpy(pathname, d->d_name, sizeof(pathname));
46+ else
47+ snprintf(pathname, sizeof(pathname),
48+ "%s/%s", subpath, d->d_name);
49+
50+ str = find_origin(src_map, src_st, basepath, pathname);
51+ if (str != NULL) {
52+ closedir(dir);
53+ return str;
54+ }
55+ break;
56 }
57 }
58
59--
601.7.9.5
61
diff --git a/meta/recipes-connectivity/connman/connman/0002-storage.c-If-there-is-no-d_type-support-use-fstatat.patch b/meta/recipes-connectivity/connman/connman/0002-storage.c-If-there-is-no-d_type-support-use-fstatat.patch
new file mode 100644
index 0000000000..d3205c0e68
--- /dev/null
+++ b/meta/recipes-connectivity/connman/connman/0002-storage.c-If-there-is-no-d_type-support-use-fstatat.patch
@@ -0,0 +1,49 @@
1From 7007ef32a959ac4717c19339a24fd90a68638a19 Mon Sep 17 00:00:00 2001
2From: Andrei Gherzan <andrei@gherzan.ro>
3Date: Tue, 17 Jul 2012 16:07:17 +0300
4Subject: [PATCH V3 2/2] storage.c: If there is no d_type support use
5 fstatat()
6
7This is useful for filesystems where d_type is always DT_UNKNOWN.
8In this case use fstatat() function.
9
10Signed-off-by: Andrei Gherzan <andrei.gherzan@windriver.com>
11Upstream-Status: Submitted
12
13---
14 src/storage.c | 19 +++++++++++++++++++
15 1 file changed, 19 insertions(+)
16
17diff --git a/src/storage.c b/src/storage.c
18index 47bd0cb..0491a52 100644
19--- a/src/storage.c
20+++ b/src/storage.c
21@@ -206,6 +206,25 @@ gchar **connman_storage_get_services()
22
23 g_string_append_printf(result, "%s/", d->d_name);
24 break;
25+ case DT_UNKNOWN:
26+ /*
27+ * If there is no d_type support use fstatat()
28+ * to check if directory
29+ */
30+ ret = fstatat(dirfd(dir), d->d_name, &buf, 0);
31+ if (ret < 0)
32+ continue;
33+ if (!(buf.st_mode & S_IFDIR))
34+ continue;
35+ str = g_strdup_printf("%s/%s/settings", STORAGEDIR,
36+ d->d_name);
37+ ret = stat(str, &buf);
38+ g_free(str);
39+ if (ret < 0)
40+ continue;
41+
42+ g_string_append_printf(result, "%s/", d->d_name);
43+ break;
44 }
45 }
46
47--
481.7.9.5
49
diff --git a/meta/recipes-connectivity/connman/connman_1.3.bb b/meta/recipes-connectivity/connman/connman_1.3.bb
index 1e3d138fc2..a98b46ca1b 100644
--- a/meta/recipes-connectivity/connman/connman_1.3.bb
+++ b/meta/recipes-connectivity/connman/connman_1.3.bb
@@ -5,6 +5,8 @@ SRCREV = "3c0fa84091524c7cd6237744f2088ffee2f1d5ad"
5SRC_URI = "git://git.kernel.org/pub/scm/network/connman/connman.git \ 5SRC_URI = "git://git.kernel.org/pub/scm/network/connman/connman.git \
6 file://0001-plugin.h-Change-visibility-to-default-for-debug-symb.patch \ 6 file://0001-plugin.h-Change-visibility-to-default-for-debug-symb.patch \
7 file://add_xuser_dbus_permission.patch \ 7 file://add_xuser_dbus_permission.patch \
8 file://connman" 8 file://connman \
9 file://0002-storage.c-If-there-is-no-d_type-support-use-fstatat.patch \
10 file://0001-timezone.c-If-there-is-no-d_type-support-use-fstatat.patch"
9S = "${WORKDIR}/git" 11S = "${WORKDIR}/git"
10PR = "${INC_PR}.0" 12PR = "${INC_PR}.1"