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

diff --git a/src/storage.c b/src/storage.c
index 47bd0cb..3bd4241 100644
--- a/src/storage.c
+++ b/src/storage.c
@@ -206,6 +206,27 @@ 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
+                        */
+                       str = g_strdup_printf("%s/%s", STORAGEDIR, d->d_name);
+                       ret = stat(str, &buf);
+                       g_free(str);
+                       if (ret < 0)
+                               continue;
+                       if (buf.st_mode & S_IFDIR) {
+                               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