mirror of
https://gitee.com/openharmony/startup_init
synced 2024-11-23 16:20:00 +00:00
update services/init/standard/device.c.
先判断dev是否已挂载文件系统,没有挂载则挂载tmpfs,已经挂载则不再重复挂载。 Signed-off-by: liangshenglin1 <liangshenglin1@huawei.com>
This commit is contained in:
parent
c246fbeb58
commit
7c9faf6f1c
@ -14,6 +14,7 @@
|
||||
*/
|
||||
#include "device.h"
|
||||
|
||||
#include <unistd.h>
|
||||
#include <errno.h>
|
||||
#include <fcntl.h>
|
||||
#include <sys/mount.h>
|
||||
@ -28,8 +29,13 @@
|
||||
|
||||
static void MountBasicFs(void)
|
||||
{
|
||||
if (mount("tmpfs", "/dev", "tmpfs", MS_NOSUID, "mode=0755") != 0) {
|
||||
INIT_LOGE("Mount tmpfs failed. %s", strerror(errno));
|
||||
if (access("dev/null", F_OK) != 0) {
|
||||
INIT_LOGI("mount dev tmpfs");
|
||||
if (mount("tmpfs", "/dev", "tmpfs", MS_NOSUID, "mode=0755") != 0) {
|
||||
INIT_LOGE("Mount tmpfs failed. %s", strerror(errno));
|
||||
}
|
||||
} else {
|
||||
INIT_LOGI("dev already mounted");
|
||||
}
|
||||
if (mount("tmpfs", "/mnt", "tmpfs", MS_NOSUID, "mode=0755") != 0) {
|
||||
INIT_LOGE("Mount tmpfs failed. %s", strerror(errno));
|
||||
|
Loading…
Reference in New Issue
Block a user