hyleong / sersync

Automatically exported from code.google.com/p/sersync
0 stars 0 forks source link

sersync2 chown 时崩溃 #69

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
1. chown -R user:use/the watch path
2. 开启了inotify的 attrib 其他默认

报错退出信息:
terminate called after throwing an instance of 'terminate called recursively
std::out_of_range'

望修复, 由衷感谢sersync开发人员.

Original issue reported on code.google.com by WJ0...@gmail.com on 27 May 2014 at 6:08

zayki commented 4 years ago

出现这个问题的原因是substr取值范围的问题,索引值应该比长度小1.我的改动如下,请参考。

[root@redis05 ]# grep -n substr Inotify.cpp 186: string tmp = pre.substr(m_watch.size() - 1, length) + "/"; 221: } else if (i->second.substr(0, path.length()-1) == path) //查找已经添加的监控 256: pre = tmp.substr(m_watch.size() - 1, length - 1);