18 namespace cvmfs_suid {
27 string normalized_path(path);
29 while ((pos = normalized_path.find(
"//")) != string::npos) {
30 normalized_path.replace(pos, 2,
"/");
33 if (normalized_path ==
"/")
37 unsigned length = normalized_path.length();
39 for (
unsigned i = 0; i < length; ++i) {
40 char c = normalized_path[i];
42 if ((i == 0) || (i == length - 1))
44 result.push_back(
'-');
45 }
else if ((c ==
'.') && (i > 0)) {
46 result.push_back(
'.');
47 }
else if (sanitizer.
IsValid(
string(&c, 1))) {
50 result.push_back(
'\\');
51 result.push_back(
'x');
52 result.push_back((c / 16) + ((c / 16 <= 9) ?
'0' :
'a'-10));
53 result.push_back((c % 16) + ((c % 16 <= 9) ?
'0' :
'a'-10));
57 return result +
".mount";
63 int retval = stat(path.c_str(), &info);
70 char *retval = realpath(path.c_str(), buf);
71 if (retval == NULL)
return "";
assert((mem||(size==0))&&"Out Of Memory")
string EscapeSystemdUnit(const string &path)
string ResolvePath(const std::string &path)
bool PathExists(const std::string &path)