eio - protect against posible segv on rename with eio

this MIGHT fix T45 but i can't reproduce to confirm, but reading a
backtrace indicates this could have been the issue. it looks like
there is room for a dangling pointer anyway, so fix.

stable release - cherry-pick me!
This commit is contained in:
Carsten Haitzler 2014-01-07 17:49:29 +09:00
parent e9783c3caf
commit 323f293ab5
1 changed files with 9 additions and 1 deletions

View File

@ -201,7 +201,11 @@ _eio_monitor_rename(Eio_Monitor *monitor, const char *newpath)
const char *tmp;
/* destroy old state */
if (monitor->exist) eio_file_cancel(monitor->exist);
if (monitor->exist)
{
eio_file_cancel(monitor->exist);
monitor->exist = NULL;
}
if (monitor->backend)
{
@ -218,11 +222,15 @@ _eio_monitor_rename(Eio_Monitor *monitor, const char *newpath)
eina_stringshare_del(tmp);
/* That means death (cmp pointer and not content) */
/* this - i think, is wrong. if the paths are the same, we should just
* re-stat anyway. imagine the file was renamed and then replaced?
* disable this as this was part of a possible crash due to eio.
if (tmp == monitor->path)
{
_eio_monitor_error(monitor, -1);
return;
}
*/
EINA_REFCOUNT_REF(monitor); /* as we spawn a thread for this monitor, we need to refcount specifically for it */