From bbcde33f93ab786f0cafdfbfbdead20cd1009d7d Mon Sep 17 00:00:00 2001 From: "Carsten Haitzler (Rasterman)" Date: Sat, 23 Apr 2016 23:45:28 +0900 Subject: [PATCH] fix efreet/file monitor stringshare optimization fixes e4d815dc48c660a336670ec3cc67e6becbdcacfc that i just put in a few days back - it's a good idea to copy the string into your buffer to use it.. not just 0 terminate it. :) --- src/lib/ecore_file/ecore_file_monitor_inotify.c | 1 + src/lib/ecore_file/ecore_file_monitor_poll.c | 1 + src/lib/ecore_file/ecore_file_monitor_win32.c | 1 + 3 files changed, 3 insertions(+) diff --git a/src/lib/ecore_file/ecore_file_monitor_inotify.c b/src/lib/ecore_file/ecore_file_monitor_inotify.c index 374d709..fa21421 100644 --- a/src/lib/ecore_file/ecore_file_monitor_inotify.c +++ b/src/lib/ecore_file/ecore_file_monitor_inotify.c @@ -126,6 +126,7 @@ ecore_file_monitor_backend_add(const char *path, len = strlen(path); path2 = alloca(len + 1); + strcpy(path2, path); if (path2[len - 1] == '/' && strcmp(path2, "/")) path2[len - 1] = 0; em->path = eina_stringshare_add(path2); diff --git a/src/lib/ecore_file/ecore_file_monitor_poll.c b/src/lib/ecore_file/ecore_file_monitor_poll.c index 16f8419..d2034dc 100644 --- a/src/lib/ecore_file/ecore_file_monitor_poll.c +++ b/src/lib/ecore_file/ecore_file_monitor_poll.c @@ -87,6 +87,7 @@ ecore_file_monitor_backend_add(const char *path, len = strlen(path); path2 = alloca(len + 1); + strcpy(path2, path); if (path2[len - 1] == '/' && strcmp(path2, "/")) path2[len - 1] = 0; em->path = eina_stringshare_add(path2); diff --git a/src/lib/ecore_file/ecore_file_monitor_win32.c b/src/lib/ecore_file/ecore_file_monitor_win32.c index 20f2ad0..8a0f92d 100644 --- a/src/lib/ecore_file/ecore_file_monitor_win32.c +++ b/src/lib/ecore_file/ecore_file_monitor_win32.c @@ -259,6 +259,7 @@ ecore_file_monitor_backend_add(const char *path, len = strlen(path); path2 = alloca(len + 1); + strcpy(path2, path); if (path2[len - 1] == '/' || path2[len - 1] == '\\') path2[len - 1] = 0; em->path = eina_stringshare_add(path2); -- 2.7.4