From: Daniel Wagner <[email protected]>

---

v1: remove unnessary empty line
v0: initial version

 src/main.c  |    6 ++++++
 src/stats.c |    5 ++---
 2 files changed, 8 insertions(+), 3 deletions(-)

diff --git a/src/main.c b/src/main.c
index 28e72ba..0574a4f 100644
--- a/src/main.c
+++ b/src/main.c
@@ -172,6 +172,12 @@ int main(int argc, char *argv[])
                        perror("Failed to create storage directory");
        }
 
+       if (mkdir(STORAGEDIR "/stats", S_IRUSR | S_IWUSR | S_IXUSR |
+                               S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH) < 0) {
+               if (errno != EEXIST)
+                       perror("Failed to create statistic storage directory");
+       }
+
        old_umask = umask(077);
 
        main_loop = g_main_loop_new(NULL, FALSE);
diff --git a/src/stats.c b/src/stats.c
index 9e14021..21f081f 100644
--- a/src/stats.c
+++ b/src/stats.c
@@ -258,10 +258,10 @@ static int stats_open_file(struct connman_service 
*service,
        connman_bool_t new_file = FALSE;
 
        if (roaming == FALSE) {
-               name = g_strdup_printf("%s/%s.data", STORAGEDIR,
+               name = g_strdup_printf("%s/stats/%s.data", STORAGEDIR,
                                        __connman_service_get_ident(service));
        } else {
-               name = g_strdup_printf("%s/%s-roaming.data", STORAGEDIR,
+               name = g_strdup_printf("%s/stats/%s-roaming.data", STORAGEDIR,
                                        __connman_service_get_ident(service));
        }
 
@@ -288,7 +288,6 @@ static int stats_open_file(struct connman_service *service,
        else
                size = (size_t)buf.st_size;
 
-
        err = stats_file_remap(file, size);
        if (err < 0)
                return err;
-- 
1.7.2.2

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

Reply via email to