summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorChris Wilson <chris+github@qwirx.com>2007-01-15 21:38:53 +0000
committerChris Wilson <chris+github@qwirx.com>2007-01-15 21:38:53 +0000
commitb8e98d8ef95d57d81535e6c6e5dcbd411990669a (patch)
tree15449a4bec395439558b1b290c1c8fb2cfa2f8ec /lib
parentd0acc07e0f1ec76f8fea3a3801d254565568d275 (diff)
Detect reparse points and change the device number (refs #3)
Diffstat (limited to 'lib')
-rw-r--r--lib/win32/emu.cpp45
1 files changed, 29 insertions, 16 deletions
diff --git a/lib/win32/emu.cpp b/lib/win32/emu.cpp
index 205ada9b..da4ecb2a 100644
--- a/lib/win32/emu.cpp
+++ b/lib/win32/emu.cpp
@@ -46,24 +46,21 @@ int setitimer(int type, struct itimerval *timeout, void *arg)
{
ASSERT(gTimerInitialised);
- if (ITIMER_VIRTUAL == type)
+ EnterCriticalSection(&gLock);
+ // we only need seconds for the mo!
+ if (timeout->it_value.tv_sec == 0 &&
+ timeout->it_value.tv_usec == 0)
{
- EnterCriticalSection(&gLock);
- // we only need seconds for the mo!
- if (timeout->it_value.tv_sec == 0 &&
- timeout->it_value.tv_usec == 0)
- {
- gTimerList.clear();
- }
- else
- {
- Timer_t ourTimer;
- ourTimer.countDown = timeout->it_value.tv_sec;
- ourTimer.interval = timeout->it_interval.tv_sec;
- gTimerList.push_back(ourTimer);
- }
- LeaveCriticalSection(&gLock);
+ gTimerList.clear();
+ }
+ else
+ {
+ Timer_t ourTimer;
+ ourTimer.countDown = timeout->it_value.tv_sec;
+ ourTimer.interval = timeout->it_interval.tv_sec;
+ gTimerList.push_back(ourTimer);
}
+ LeaveCriticalSection(&gLock);
// indicate success
return 0;
@@ -674,6 +671,22 @@ int emu_fstat(HANDLE hdir, struct stat * st)
st->st_mode |= S_IWRITE;
}
+ // st_dev is nroammly zero, regardless of the drive letter,
+ // since backup locations can't normally span drives. However,
+ // a reparse point does allow all kinds of weird stuff to happen.
+ // We set st_dev to 1 for a reparse point, so that Box will detect
+ // a change of device number (from 0) and refuse to recurse down
+ // the reparse point (which could lead to havoc).
+
+ if (fi.dwFileAttributes & FILE_ATTRIBUTE_REPARSE_POINT)
+ {
+ st->st_dev = 1;
+ }
+ else
+ {
+ st->st_dev = 0;
+ }
+
return 0;
}