Put .data files into a separate directory
authorDaniel Wagner <daniel.wagner@bmw-carit.de>
Thu, 23 Sep 2010 11:25:18 +0000 (13:25 +0200)
committerMarcel Holtmann <marcel@holtmann.org>
Thu, 23 Sep 2010 12:45:48 +0000 (21:45 +0900)
src/main.c
src/stats.c

index 28e72ba..dd7084b 100644 (file)
@@ -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 statistics directory");
+       }
+
        old_umask = umask(077);
 
        main_loop = g_main_loop_new(NULL, FALSE);
index 08f3dd2..6f6e2c7 100644 (file)
@@ -257,10 +257,10 @@ static int stats_open_file(struct connman_service *service,
        struct stats_file_header *hdr;
 
        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));
        }