mirror of
https://gitee.com/openharmony/startup_init
synced 2024-12-18 16:37:50 +00:00
!1306 修复sys_prod挂载unmount丢失
Merge pull request !1306 from cheng_jinsong/fix_under_mount
This commit is contained in:
commit
69df15ef8e
@ -25,6 +25,7 @@
|
||||
#include "init_log.h"
|
||||
#include "fs_manager/fs_manager.h"
|
||||
#include "securec.h"
|
||||
#include "init_utils.h"
|
||||
|
||||
static void FreeOldRoot(DIR *dir, dev_t dev)
|
||||
{
|
||||
@ -77,21 +78,14 @@ static void FreeOldRoot(DIR *dir, dev_t dev)
|
||||
// all sub mount tree in the future.
|
||||
static bool UnderBasicMountPoint(const char *path)
|
||||
{
|
||||
unsigned int i;
|
||||
if (path == NULL || *path == '\0') {
|
||||
return false;
|
||||
}
|
||||
|
||||
size_t pathSize = strlen(path);
|
||||
if (strncmp(path, "/dev/", strlen("/dev/")) == 0 && pathSize > strlen("/dev/")) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (strncmp(path, "/sys/", strlen("/sys/")) == 0 && pathSize > strlen("/sys/")) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (strncmp(path, "/proc/", strlen("/proc/")) == 0 && pathSize > strlen("/proc/")) {
|
||||
return true;
|
||||
const char *basicMountPoint[] = {"/dev/", "/sys/", "/proc/"};
|
||||
for (i = 0; i < ARRAY_LENGTH(basicMountPoint); i++) {
|
||||
if (strncmp(path, basicMountPoint[i], strlen(basicMountPoint[i])) == 0)
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user