Check if already mounted before mounting

This commit is contained in:
Vitaliy Filippov
2024-03-16 13:24:36 +03:00
parent 05f5f46162
commit 5b747c12ec
6 changed files with 41 additions and 15 deletions
-13
View File
@@ -42,19 +42,6 @@ void fromhexstr(const std::string & from, int bytes, uint8_t *to)
}
}
std::string realpath_str(std::string path, bool nofail)
{
char *p = realpath((char*)path.c_str(), NULL);
if (!p)
{
fprintf(stderr, "Failed to resolve %s: %s\n", path.c_str(), strerror(errno));
return nofail ? path : "";
}
std::string rp(p);
free(p);
return rp;
}
// returns 1 = check error, 0 = write through, -1 = write back
// (similar to 1 = warning, -1 = error, 0 = success in disable_cache)
static int check_queue_cache(std::string dev, std::string parent_dev)