mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
IDEA-109028 (fsnotifier to not panic on incorrect paths)
This commit is contained in:
Binary file not shown.
Binary file not shown.
@@ -305,14 +305,17 @@ int watch(const char* root, array* mounts) {
|
||||
|
||||
struct stat st;
|
||||
if (stat(root, &st) != 0) {
|
||||
if (errno == EACCES) {
|
||||
return ERR_IGNORE;
|
||||
}
|
||||
else if (errno == ENOENT) {
|
||||
if (errno == ENOENT) {
|
||||
return ERR_MISSING;
|
||||
}
|
||||
userlog(LOG_ERR, "stat(%s): %s", root, strerror(errno));
|
||||
return ERR_ABORT;
|
||||
else if (errno == EACCES || errno == ELOOP || errno == ENAMETOOLONG || errno == ENOTDIR) {
|
||||
userlog(LOG_INFO, "stat(%s): %s", root, strerror(errno));
|
||||
return ERR_CONTINUE;
|
||||
}
|
||||
else {
|
||||
userlog(LOG_ERR, "stat(%s): %s", root, strerror(errno));
|
||||
return ERR_ABORT;
|
||||
}
|
||||
}
|
||||
|
||||
if (S_ISREG(st.st_mode)) {
|
||||
|
||||
@@ -36,7 +36,7 @@
|
||||
#define LOG_ENV_ERROR "error"
|
||||
#define LOG_ENV_OFF "off"
|
||||
|
||||
#define VERSION "20130415.2136"
|
||||
#define VERSION "20130617.1827"
|
||||
#define VERSION_MSG "fsnotifier " VERSION "\n"
|
||||
|
||||
#define USAGE_MSG \
|
||||
|
||||
@@ -292,6 +292,26 @@ public class FileWatcherTest extends PlatformLangTestCase {
|
||||
}
|
||||
}
|
||||
|
||||
public void testIncorrectPath() throws Exception {
|
||||
File topDir = createTestDir("top");
|
||||
File file = createTestFile(topDir, "file.zip");
|
||||
File subDir = new File(file, "sub/zip");
|
||||
refresh(topDir);
|
||||
|
||||
LocalFileSystem.WatchRequest request = watch(subDir, false);
|
||||
try {
|
||||
myTimeout = 10 * INTER_RESPONSE_DELAY;
|
||||
myAccept = true;
|
||||
FileUtil.writeToFile(file, "new content");
|
||||
assertEvent(VFileEvent.class);
|
||||
myTimeout = NATIVE_PROCESS_DELAY;
|
||||
}
|
||||
finally {
|
||||
unwatch(request);
|
||||
delete(topDir);
|
||||
}
|
||||
}
|
||||
|
||||
public void testDirectoryOverlapping() throws Exception {
|
||||
File topDir = createTestDir("top");
|
||||
File fileInTopDir = createTestFile(topDir, "file1.txt");
|
||||
|
||||
Reference in New Issue
Block a user