Checked file stat before realpath 63/185263/1 accepted/tizen/unified/20180801.144858 submit/tizen/20180727.073401 submit/tizen/20180731.041744
authorhyunuktak <hyunuk.tak@samsung.com>
Fri, 27 Jul 2018 06:26:35 +0000 (15:26 +0900)
committerhyunuktak <hyunuk.tak@samsung.com>
Fri, 27 Jul 2018 06:26:42 +0000 (15:26 +0900)
Change-Id: Iae4a7b7f97b90389a5c35ccf6144e42b3b525d02
Signed-off-by: hyunuktak <hyunuk.tak@samsung.com>
packaging/stc-manager.spec
src/helper/helper-file.c [changed mode: 0644->0755]
src/helper/helper-file.h [changed mode: 0644->0755]

index b379e73..7e20304 100644 (file)
@@ -1,6 +1,6 @@
 Name:       stc-manager
 Summary:    STC(Smart Traffic Control) manager
-Version:    0.0.72
+Version:    0.0.73
 Release:    0
 Group:      Network & Connectivity/Other
 License:    Apache-2.0
old mode 100644 (file)
new mode 100755 (executable)
index 636ef5d..73b93bd
@@ -24,14 +24,17 @@ int fwrite_str(const char *path, const char *str)
        _cleanup_fclose_ FILE *f = NULL;
        int ret;
        char * t;
+       struct stat stat_buf;
 
        assert(path);
        assert(str);
 
-       t = realpath(path, NULL);
-       ret_value_errno_msg_if(!t, -errno,
-                              "Fail to get realpath %s", path);
-       free(t);
+       if (stat(path, &stat_buf) == 0) {
+               t = realpath(path, NULL);
+               ret_value_errno_msg_if(!t, -errno,
+                                      "Fail to get realpath %s", path);
+               free(t);
+       }
 
        f = fopen(path, "w");
        ret_value_errno_msg_if(!f, -errno,
old mode 100644 (file)
new mode 100755 (executable)
index c5ff1b8..b45a668
@@ -21,6 +21,7 @@
 #include <errno.h>
 #include <fcntl.h>
 #include <stdlib.h>
+#include <sys/stat.h>
 
 #include "stc-manager.h"