]> git.eshelyaron.com Git - emacs.git/commitdiff
Zero out dirwatch->dir when bailing out for any reason.
authorEli Zaretskii <eliz@gnu.org>
Sun, 7 Oct 2012 15:54:07 +0000 (17:54 +0200)
committerEli Zaretskii <eliz@gnu.org>
Sun, 7 Oct 2012 15:54:07 +0000 (17:54 +0200)
Signal an error if a watch is requested while another one is active.

src/w32notify.c

index 81199b2a0a16b6f23dbb7165a2f29591e7f02bba..c5cfa3dba44ff40971c7db084a019e56bd5f77d2 100644 (file)
@@ -203,6 +203,7 @@ watch_completion (DWORD status, DWORD bytes_ret, OVERLAPPED *io_info)
       dirwatch->io_info = NULL;
       xfree (dirwatch->watchee);
       dirwatch->watchee = NULL;
+      dirwatch->dir = NULL;
       dirwatch->terminate = 1;
     }
   else
@@ -285,6 +286,7 @@ start_watching (const char *file, HANDLE hdir, BOOL subdirs, DWORD flags)
       dirwatch.io_info = NULL;
       xfree (dirwatch.watchee);
       dirwatch.watchee = NULL;
+      dirwatch.dir = NULL;
       return -1;
     }
   return 0;
@@ -471,6 +473,9 @@ FILE is the name of the file whose event is being reported.  */)
                         Qnil);
     }
 
+  if (dirwatch.dir)
+    error ("File watch already active");
+
   /* We needa full absolute file name of FILE, and we need to remove
      any trailing slashes from it, so that GetFullPathName below gets
      the basename part correctly.  */