fix protocol violation in fsnotifier (IDEADEV-34652)
authorDmitry Jemerov <yole@intellij.com>
Tue, 10 Feb 2009 16:21:21 +0000 (19:21 +0300)
committerDmitry Jemerov <yole@intellij.com>
Tue, 10 Feb 2009 16:21:21 +0000 (19:21 +0300)
bin/fsnotifier.exe
tools/fileWatcher3/fileWatcher3.cpp

index 2a9d49c184530ee6452e069bd1d2ab63d67831a9..265c94f7ea03858b484eac5f2a33ad9ba4914db5 100644 (file)
Binary files a/bin/fsnotifier.exe and b/bin/fsnotifier.exe differ
index 556148f141a6fc46bf981b75d8c4f453338b5e00..8c61739b839849164257642735f1b786c09e9b27 100644 (file)
@@ -266,7 +266,6 @@ void StopRoot(WatchRootInfo *info)
 
 void UpdateRoots()
 {
-       bool haveUnwatchableRoots = false;
        char infoBuffer [256];
        strcpy_s(infoBuffer, "UNWATCHEABLE\n");
        for(int i=0; i<ROOT_COUNT; i++)
@@ -282,7 +281,6 @@ void UpdateRoots()
                        sprintf_s(rootPath, 8, "%c:\\", watchRootInfos [i].driveLetter);
                        if (!IsWatchable(rootPath))
                        {
-                               haveUnwatchableRoots = true;
                                strcat_s(infoBuffer, rootPath);
                                strcat_s(infoBuffer, "\n");
                                continue;
@@ -291,17 +289,22 @@ void UpdateRoots()
                        {
                                StartRoot(&watchRootInfos [i]);
                        }
-                       PrintMountPoints(rootPath);
                }
        }
-       if (haveUnwatchableRoots)
+       EnterCriticalSection(&csOutput);
+       fprintf(stdout, "%s", infoBuffer);
+       for(int i=0; i<ROOT_COUNT; i++)
        {
-               strcat_s(infoBuffer, "#");
-               EnterCriticalSection(&csOutput);
-               puts(infoBuffer);
-               fflush(stdout);
-               LeaveCriticalSection(&csOutput);
+               if (watchRootInfos [i].bUsed)
+               {
+                       char rootPath[8];
+                       sprintf_s(rootPath, 8, "%c:\\", watchRootInfos [i].driveLetter);
+                       PrintMountPoints(rootPath);
+               }
        }
+       puts("#");
+       fflush(stdout);
+       LeaveCriticalSection(&csOutput);
 }
 
 int _tmain(int argc, _TCHAR* argv[])