GCC Code Coverage Report
Directory: cvmfs/ Exec Total Coverage
File: cvmfs/receiver/lease_path_util.cc Lines: 8 8 100.0 %
Date: 2019-02-03 02:48:13 Branches: 10 10 100.0 %

Line Branch Exec Source
1
/**
2
 * This file is part of the CernVM File System.
3
 */
4
5
#include "lease_path_util.h"
6
7
namespace receiver {
8
9
14
bool IsPathInLease(const PathString& lease, const PathString& path) {
10
  // If lease is "", any path falls within item
11
14
  if (!strcmp(lease.c_str(), "")) {
12
8
    return true;
13
  }
14
15
  // Is the lease string is the prefix of the path string and the next
16
  // character of the path string is a "/".
17

6
  if (path.StartsWith(lease) && path.GetChars()[lease.GetLength()] == '/') {
18
1
    return true;
19
  }
20
21
  // If the path string is exactly the lease path return true (allow the
22
  // creation of the leased directory during the lease itself)
23
5
  if (lease == path) {
24
1
    return true;
25
  }
26
27
4
  return false;
28
}
29
30
}  // namespace receiver