This is usefull for filesystems where d_type is always DT_UNKNOWN.
In this case use stat() function.
---
 src/storage.c |   19 +++++++++++++++++++
 1 file changed, 19 insertions(+)

diff --git a/src/storage.c b/src/storage.c
index 47bd0cb..0cffa0a 100644
--- a/src/storage.c
+++ b/src/storage.c
@@ -206,6 +206,25 @@ gchar **connman_storage_get_services()
 
                        g_string_append_printf(result, "%s/", d->d_name);
                        break;
+               case DT_UNKNOWN:
+                       /*
+                        * If there is no d_type support use stat()
+                        * to check if directory
+                        */
+                       ret = fstatat(dirfd(dir), d->d_name, &buf, 0);
+                       if (ret < 0)
+                               continue;
+                       if (!buf.st_mode & S_IFDIR)
+                               break;
+                       str = g_strdup_printf("%s/%s/settings", STORAGEDIR,
+                                                       d->d_name);
+                       ret = stat(str, &buf);
+                       g_free(str);
+                       if (ret < 0)
+                               continue;
+
+                       g_string_append_printf(result, "%s/", d->d_name);
+                       break;
                }
        }
 
-- 
1.7.9.5

_______________________________________________
connman mailing list
[email protected]
http://lists.connman.net/listinfo/connman

Reply via email to