summaryrefslogtreecommitdiffstats
path: root/drivers/unix/os_unix.cpp
diff options
context:
space:
mode:
authorRémi Verschelde <rverschelde@gmail.com>2018-10-07 15:23:38 +0200
committerGitHub <noreply@github.com>2018-10-07 15:23:38 +0200
commit5676632a3bb8562b3346a3afba4069501365b35f (patch)
tree79c0d2f4a5378a97535e35df18533d09066b1033 /drivers/unix/os_unix.cpp
parentcff89fc4e4f2ceb577b5f7a119d98cb22d41ea44 (diff)
parentd65afb2c7474f4f7b19aacc74dd3956ee491c60b (diff)
downloadredot-engine-5676632a3bb8562b3346a3afba4069501365b35f.tar.gz
Merge pull request #22788 from Faless/warnings_fix
Some warnings fix
Diffstat (limited to 'drivers/unix/os_unix.cpp')
-rw-r--r--drivers/unix/os_unix.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/drivers/unix/os_unix.cpp b/drivers/unix/os_unix.cpp
index 6c70934bc6..7ff27be501 100644
--- a/drivers/unix/os_unix.cpp
+++ b/drivers/unix/os_unix.cpp
@@ -487,9 +487,11 @@ String OS_Unix::get_executable_path() const {
//fix for running from a symlink
char buf[256];
memset(buf, 0, 256);
- readlink("/proc/self/exe", buf, sizeof(buf));
+ ssize_t len = readlink("/proc/self/exe", buf, sizeof(buf));
String b;
- b.parse_utf8(buf);
+ if (len > 0) {
+ b.parse_utf8(buf, len);
+ }
if (b == "") {
WARN_PRINT("Couldn't get executable path from /proc/self/exe, using argv[0]");
return OS::get_executable_path();