MCPcopy Create free account
hub / github.com/bailey27/cppcryptfs / check_node_clean

Method check_node_clean

libcppcryptfs/filename/dirivcache.cpp:102–136  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

100}
101
102bool DirIvCache::check_node_clean(DirIvCacheNode *node, const wstring& path)
103{
104
105 if (!m_ttl || (GetTickCount64() - node->m_timestamp < m_ttl))
106 return true;
107
108 wstring filepath = path;
109
110 // already normalized with trailing slash
111 filepath += DIR_IV_NAME;
112
113 HANDLE hFile = CreateFile(&filepath[0], FILE_READ_ATTRIBUTES, FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE, NULL,
114 OPEN_EXISTING, 0, NULL);
115
116 if (hFile == INVALID_HANDLE_VALUE)
117 return false;
118
119 FILETIME LastWriteTime;
120
121 BOOL bResult = GetFileTime(hFile, NULL, NULL, &LastWriteTime);
122
123 CloseHandle(hFile);
124
125 if (!bResult)
126 return false;
127
128 bResult = CompareFileTime(&node->m_last_write_time, &LastWriteTime) >= 0;
129
130 if (bResult) {
131 node->m_timestamp = GetTickCount64();
132 return true;
133 } else {
134 return false;
135 }
136}
137
138void DirIvCache::update_lru(DirIvCacheNode *node)
139{

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected