From: Daniel Wagner Date: Mon, 11 Oct 2010 09:17:03 +0000 (+0200) Subject: Initialize struct stat in error case correctly X-Git-Tag: accepted/2.0alpha-wayland/20121110.002834~2296 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=8661f92deddc16c69b5e9f4fcebf98e66f64f771;p=profile%2Fivi%2Fconnman.git Initialize struct stat in error case correctly 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. --- diff --git a/src/stats.c b/src/stats.c index b290c13..f646bac 100644 --- a/src/stats.c +++ b/src/stats.c @@ -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; }