summaryrefslogtreecommitdiffstats
path: root/meta/recipes-connectivity/connman/connman
diff options
context:
space:
mode:
Diffstat (limited to 'meta/recipes-connectivity/connman/connman')
-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
2 files changed, 110 insertions, 0 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 0000000..3bced52
--- /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 0000000..d3205c0
--- /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