From: kibak.yoon Date: Tue, 18 Jul 2017 09:59:59 +0000 (+0900) Subject: sensord: check type whether it is a regular file or not X-Git-Tag: accepted/tizen/4.0/unified/20170816.013925^2~1 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Fchanges%2F13%2F139313%2F1;p=platform%2Fcore%2Fsystem%2Fsensord.git sensord: check type whether it is a regular file or not Change-Id: I8b72cd6702def0a57d5ce570cb183d90f43519f6 Signed-off-by: kibak.yoon --- diff --git a/src/server/server.cpp b/src/server/server.cpp index 22b3987..237f658 100644 --- a/src/server/server.cpp +++ b/src/server/server.cpp @@ -20,6 +20,7 @@ #include "server.h" #include +#include #include #include #include @@ -112,6 +113,14 @@ void server::deinit(void) static void set_cal_data(const char *path) { + struct stat file_stat; + + if (lstat(path, &file_stat) != 0) + return; + + if (!S_ISREG(file_stat.st_mode)) + return; + FILE *fp = fopen(path, "w"); retm_if(!fp, "There is no calibration file[%s]", path);