[dali_1.4.27] Merge branch 'devel/master'
[platform/core/uifw/dali-toolkit.git] / dali-toolkit / internal / builder / builder-filesystem.h
old mode 100644 (file)
new mode 100755 (executable)
index bbb77d7..75e9d28
@@ -1,8 +1,8 @@
-#ifndef __DALI_TOOLKIT_INTERNAL_BUILDER_FILESYSTEM_H__
-#define __DALI_TOOLKIT_INTERNAL_BUILDER_FILESYSTEM_H__
+#ifndef DALI_TOOLKIT_INTERNAL_BUILDER_FILESYSTEM_H
+#define DALI_TOOLKIT_INTERNAL_BUILDER_FILESYSTEM_H
 
 /*
- * Copyright (c) 2014 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2019 Samsung Electronics Co., Ltd.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -46,7 +46,9 @@ inline std::string ExpandPath(const std::string &name)
 inline std::string ExePath(void)
 {
   char buf[256];
-  readlink("/proc/self/exe", buf, sizeof(buf));
+  ssize_t len = readlink("/proc/self/exe", buf, sizeof(buf) - 1);
+  len = len > 0 ? len : 0;
+  buf[len] = '\0';
   return std::string(buf);
 }
 
@@ -56,4 +58,4 @@ inline std::string GetFileContents(const std::string &fn)
   return std::string((std::istreambuf_iterator<char>(t)), std::istreambuf_iterator<char>());
 }
 
-#endif // __DALI_TOOLKIT_INTERNAL_BUILDER_FILESYSTEM_H__
+#endif // DALI_TOOLKIT_INTERNAL_BUILDER_FILESYSTEM_H