Commit 7d605354 authored by Eli Zaretskii's avatar Eli Zaretskii
Browse files

Zero out dirwatch->dir when bailing out for any reason.

Signal an error if a watch is requested while another one is active.
parent c5c91b84
......@@ -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;
......@@ -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. */)
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. */
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment