mirror of
https://github.com/tuxbox-fork-migrations/recycled-ni-neutrino.git
synced 2025-08-27 15:32:52 +02:00
Apollo/Kronos: Display backup options for 'var' and 'root1'...
...only if are mounted.
- Using /proc/mounts to find correct mountpoint for backup
Origin commit data
------------------
Branch: ni/coolstream
Commit: 885f13f6b0
Author: Michael Liebmann <tuxcode.bbg@gmail.com>
Date: 2015-09-22 (Tue, 22 Sep 2015)
------------------
This commit was generated by Migit
This commit is contained in:
@@ -898,3 +898,21 @@ std::string to_string(unsigned long long i)
|
||||
return s.str();
|
||||
}
|
||||
|
||||
std::string getJFFS2MountPoint(int mtdPos)
|
||||
{
|
||||
FILE* fd = fopen("/proc/mounts", "r");
|
||||
if (!fd) return "";
|
||||
int iBlock;
|
||||
char lineRead[1024], sMount[512], sFs[512];
|
||||
memset(lineRead, '\0', sizeof(lineRead));
|
||||
while (fgets(lineRead, sizeof(lineRead)-1, fd)) {
|
||||
sscanf(lineRead, "/dev/mtdblock%d %512s %512s", &iBlock, sMount, sFs);
|
||||
if ((iBlock == mtdPos) && (strstr(sMount, "/") != NULL) && (strstr(sFs, "jffs2") != NULL)) {
|
||||
fclose(fd);
|
||||
return sMount;
|
||||
}
|
||||
memset(lineRead, '\0', sizeof(lineRead));
|
||||
}
|
||||
fclose(fd);
|
||||
return "";
|
||||
}
|
||||
|
Reference in New Issue
Block a user