Initialize struct stat in error case correctly
authorDaniel Wagner <daniel.wagner@bmw-carit.de>
Mon, 11 Oct 2010 09:17:03 +0000 (11:17 +0200)
committerSamuel Ortiz <sameo@linux.intel.com>
Mon, 11 Oct 2010 09:31:33 +0000 (11:31 +0200)
In the case stat failes to gather information
about the log file, it has to initialize struct
stat. Otherwise, we will set a random file size.

src/stats.c

index b290c13..f646bac 100644 (file)
@@ -270,6 +270,7 @@ static int stats_open_file(struct connman_service *service,
        err = stat(file->name, &st);
        if (err < 0) {
                /* according documentation the only possible error is ENOENT */
+               st.st_size = 0;
                new_file = TRUE;
        }