提交 e911e928 编写于 作者: S sun_fan

init: fix fstab mount bugs

Signed-off-by: Nsun_fan <sun_fan1@hoperun.com>
上级 ab130c7a
......@@ -178,7 +178,7 @@ static int Mount(const char *source, const char *target, const char *fsType,
}
}
errno = 0;
while ((rc = mount(source, target, fsType, flags, data) != 0)) {
while ((rc = mount(source, target, fsType, flags, data)) != 0) {
if (errno == EAGAIN) {
printf("[fs_manager][warning] Mount %s to %s failed. try again", source, target);
continue;
......@@ -216,9 +216,9 @@ int MountOneItem(FstabItem *item)
int CheckRequiredAndMount(FstabItem *item, bool required)
{
int rc = -1;
int rc = 0;
if (item == NULL) {
return rc;
return -1;
}
if (required) { // Mount partition during first startup.
if (FM_MANAGER_REQUIRED_ENABLED(item->fsManagerFlags)) {
......@@ -247,6 +247,9 @@ int MountAllWithFstabFile(const char *fstabFile, bool required)
int rc = -1;
for (item = fstab->head; item != NULL; item = item->next) {
rc = CheckRequiredAndMount(item, required);
if (required && (rc < 0)) { // Init fail to mount in the first stage and exit directly.
break;
}
}
ReleaseFstab(fstab);
fstab = NULL;
......
......@@ -280,12 +280,7 @@ static void DoMountFstabFile(const struct CmdArgs *ctx, const char *cmdContent)
{
UNUSED(cmdContent);
INIT_LOGI("Mount partitions from fstab file \" %s \"", ctx->argv[0]);
int rc = MountAllWithFstabFile(ctx->argv[0], 0);
if (rc < 0) {
INIT_LOGE("Run command mount_fstab failed");
} else {
INIT_LOGI("Mount partitions from fstab done");
}
(void)MountAllWithFstabFile(ctx->argv[0], 0);
}
static void DoUmountFstabFile(const struct CmdArgs *ctx, const char *cmdContent)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册