hdd_menu: do not handle the rootfs or fs without kernel support

Origin commit data
------------------
Branch: ni/coolstream
Commit: f7bb7a70cb
Author: Stefan Seyfried <seife@tuxbox-git.slipkontur.de>
Date: 2015-02-08 (Sun, 08 Feb 2015)


------------------
No further description and justification available within origin commit message!

------------------
This commit was generated by Migit
This commit is contained in:
Stefan Seyfried
2015-02-08 15:22:15 +01:00
committed by Jacek Jendrzej
parent 47f2cfd410
commit 1a4ac8b281

View File

@@ -776,9 +776,11 @@ _show_menu:
} }
if (!hdd_list.empty()) { if (!hdd_list.empty()) {
struct stat rec_st; struct stat rec_st, root_st, dev_st;
memset(&rec_st, 0, sizeof(rec_st)); memset(&rec_st, 0, sizeof(rec_st));
memset(&root_st, 0, sizeof(root_st));
stat(g_settings.network_nfs_recordingdir.c_str(), &rec_st); stat(g_settings.network_nfs_recordingdir.c_str(), &rec_st);
stat("/", &root_st);
sort(hdd_list.begin(), hdd_list.end(), cmp_hdd_by_name()); sort(hdd_list.begin(), hdd_list.end(), cmp_hdd_by_name());
mount = g_Locale->getText(LOCALE_HDD_MOUNT); mount = g_Locale->getText(LOCALE_HDD_MOUNT);
@@ -794,6 +796,13 @@ _show_menu:
} }
std::string key = "m" + it->devname; std::string key = "m" + it->devname;
bool enabled = !rec_icon || !CNeutrinoApp::getInstance()->recordingstatus; bool enabled = !rec_icon || !CNeutrinoApp::getInstance()->recordingstatus;
/* do not allow to unmount the rootfs, and skip filesystems without kernel support */
memset(&dev_st, 0, sizeof(dev_st));
if (stat(("/dev/" + it->devname).c_str(), &dev_st) != -1
&& dev_st.st_rdev == root_st.st_dev)
enabled = false;
else if (kernel_fs_list.find(it->fmt) == kernel_fs_list.end())
enabled = false;
it->cmf = new CMenuForwarder(it->desc, enabled, it->mounted ? umount : mount , this, it->cmf = new CMenuForwarder(it->desc, enabled, it->mounted ? umount : mount , this,
key.c_str(), CRCInput::convertDigitToKey(shortcut++), NULL, rec_icon); key.c_str(), CRCInput::convertDigitToKey(shortcut++), NULL, rec_icon);
hddmenu->addItem(it->cmf); hddmenu->addItem(it->cmf);