diff options
Diffstat (limited to 'meta/recipes-connectivity/connman/connman/0001-timezone.c-If-there-is-no-d_type-support-use-fstatat.patch')
-rw-r--r-- | meta/recipes-connectivity/connman/connman/0001-timezone.c-If-there-is-no-d_type-support-use-fstatat.patch | 61 |
1 files changed, 61 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 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 @@ | |||
1 | From f2094e6b2e4542adf458d8fa58d7bccd5edb762e Mon Sep 17 00:00:00 2001 | ||
2 | From: Andrei Gherzan <andrei@gherzan.ro> | ||
3 | Date: Tue, 17 Jul 2012 17:27:39 +0300 | ||
4 | Subject: [PATCH V3 1/2] timezone.c: If there is no d_type support use | ||
5 | fstatat() | ||
6 | |||
7 | This is useful for filesystems where d_type is always DT_UNKNOWN. | ||
8 | In this case use fstatat() function. | ||
9 | |||
10 | Signed-off-by: Andrei Gherzan <andrei.gherzan@windriver.com> | ||
11 | Upstream-Status: Submitted | ||
12 | |||
13 | --- | ||
14 | src/timezone.c | 24 ++++++++++++++++++++++++ | ||
15 | 1 file changed, 24 insertions(+) | ||
16 | |||
17 | diff --git a/src/timezone.c b/src/timezone.c | ||
18 | index 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 | -- | ||
60 | 1.7.9.5 | ||
61 | |||