From 7d6053541271df526e551ab02b210ce07c7b7ce7 Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Sun, 7 Oct 2012 17:54:07 +0200 Subject: [PATCH] Zero out dirwatch->dir when bailing out for any reason. Signal an error if a watch is requested while another one is active. --- src/w32notify.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/w32notify.c b/src/w32notify.c index 81199b2a0a1..c5cfa3dba44 100644 --- a/src/w32notify.c +++ b/src/w32notify.c @@ -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. */ -- 2.39.5