summaryrefslogtreecommitdiffstats
path: root/winsup/cygwin/path.cc
diff options
context:
space:
mode:
authorChristopher Faylor <me@cgf.cx>2003-01-21 05:07:28 +0000
committerChristopher Faylor <me@cgf.cx>2003-01-21 05:07:28 +0000
commitd8cde3a3eeacd44ecc93ad092318ab243a423fb5 (patch)
tree6b2bb7cb27fc49a88469cb514af43b8821eb9bce /winsup/cygwin/path.cc
parent14d304da97f132b411b5c581e38b2bbd177cc3ca (diff)
downloadcygnal-d8cde3a3eeacd44ecc93ad092318ab243a423fb5.tar.gz
cygnal-d8cde3a3eeacd44ecc93ad092318ab243a423fb5.tar.bz2
cygnal-d8cde3a3eeacd44ecc93ad092318ab243a423fb5.zip
* path.h (etc::change_possible): Revert the type to bool.
(etc::set_last_modified): Remove obsolete function. * path.cc (etc::change_possible): Revert type to bool. (etc::test_file_change): Do not test for negative values of change_possible and do not set it to -res. (etc::dir_changed): When the handle is NULL, call memset instead of test_file_changed. When the handle is invalid, return true. (etc::file_changed): Remove unneeded check for !fn[n].
Diffstat (limited to 'winsup/cygwin/path.cc')
-rw-r--r--winsup/cygwin/path.cc23
1 files changed, 7 insertions, 16 deletions
diff --git a/winsup/cygwin/path.cc b/winsup/cygwin/path.cc
index 835fa9838..9a2418fe3 100644
--- a/winsup/cygwin/path.cc
+++ b/winsup/cygwin/path.cc
@@ -3756,7 +3756,7 @@ out:
int etc::curr_ix = 0;
/* Note that the first elements of the below arrays are unused */
-signed char etc::change_possible[MAX_ETC_FILES + 1];
+bool etc::change_possible[MAX_ETC_FILES + 1];
const char *etc::fn[MAX_ETC_FILES + 1];
FILETIME etc::last_modified[MAX_ETC_FILES + 1];
@@ -3784,12 +3784,7 @@ etc::test_file_change (int n)
WIN32_FIND_DATA data;
bool res;
- if (change_possible[n] < 0)
- {
- res = true;
- paranoid_printf ("fn[%d] %s, already marked changed", n, fn[n]);
- }
- else if ((h = FindFirstFile (fn[n], &data)) == INVALID_HANDLE_VALUE)
+ if ((h = FindFirstFile (fn[n], &data)) == INVALID_HANDLE_VALUE)
{
res = true;
memset (last_modified + n, 0, sizeof (last_modified[n]));
@@ -3800,7 +3795,6 @@ etc::test_file_change (int n)
FindClose (h);
res = CompareFileTime (&data.ftLastWriteTime, last_modified + n) > 0;
last_modified[n] = data.ftLastWriteTime;
- change_possible[n] = -res;
debug_printf ("FindFirstFile succeeded");
}
@@ -3825,16 +3819,15 @@ etc::dir_changed (int n)
system_printf ("Can't open /etc for checking, %E", (char *) pwd,
changed_h);
#endif
- for (int i = 1; i <= curr_ix; i++)
- (void) test_file_change (i);
+ memset (change_possible, true, sizeof (change_possible));
}
if (changed_h == INVALID_HANDLE_VALUE)
- (void) test_file_change (n); /* semi-brute-force way */
+ change_possible[n] = true;
else if (WaitForSingleObject (changed_h, 0) == WAIT_OBJECT_0)
{
(void) FindNextChangeNotification (changed_h);
- memset (change_possible, 1, sizeof change_possible);
+ memset (change_possible, true, sizeof change_possible);
}
}
@@ -3846,11 +3839,9 @@ bool
etc::file_changed (int n)
{
bool res = false;
- if (!fn[n])
- res = true;
- else if (dir_changed (n) && test_file_change (n))
+ if (dir_changed (n) && test_file_change (n))
res = true;
- change_possible[n] = 0;
+ change_possible[n] = false; /* Change is no longer possible */
paranoid_printf ("fn[%d] %s res %d", n, fn[n], res);
return res;
}