if (mpt->isSymlink == true) {
LOG_D("symlink('%s', '%s')", srcpath, dst);
if (symlink(srcpath, dst) == -1) {
- PLOG_W("symlink('%s', '%s')", srcpath, dst);
- return false;
+ if (mpt->mandatory) {
+ PLOG_W("symlink('%s', '%s')", srcpath, dst);
+ return false;
+ } else {
+ PLOG_W("symlink('%s', '%s'), but it's not mandatory, continuing",
+ srcpath, dst);
+ }
}
return true;
}
*/
unsigned long flags = mpt->flags & ~(MS_RDONLY);
if (mount(srcpath, dst, mpt->fs_type, flags, mpt->options) == -1) {
- if (mpt->mandatory == false) {
- PLOG_D("mount('%s') src:'%s' dst:'%s' failed", mountDescribeMountPt(mpt),
- srcpath, dst);
- } else if (errno == EACCES) {
- PLOG_E("mount('%s') src:'%s' dst:'%s' failed. "
+ if (errno == EACCES) {
+ PLOG_W("mount('%s') src:'%s' dst:'%s' failed. "
"Try fixing this problem by applying 'chmod o+x' to the '%s' directory and "
"its ancestors", mountDescribeMountPt(mpt), srcpath, dst, srcpath);
} else {
- PLOG_E("mount('%s') src:'%s' dst:'%s' failed", mountDescribeMountPt(mpt),
+ PLOG_W("mount('%s') src:'%s' dst:'%s' failed", mountDescribeMountPt(mpt),
srcpath, dst);
}
- if (mpt->mandatory) {
- return false;
- }
}
if (mpt->src_content && unlink(srcpath) == -1) {
struct statvfs vfs;
if (TEMP_FAILURE_RETRY(statvfs(mpt->dst, &vfs)) == -1) {
- if (mpt->mandatory) {
- PLOG_E("statvfs('%s')", mpt->dst);
- return false;
- } else {
- PLOG_D("statvfs('%s')", mpt->dst);
- return true;
- }
+ PLOG_W("statvfs('%s')", mpt->dst);
+ return false;
}
/*
* It's fine to use 'flags | vfs.f_flag' here as per
mountFlagsToStr(vfs.f_flag), mountFlagsToStr(new_flags));
if (mount(mpt->dst, mpt->dst, NULL, new_flags, 0) == -1) {
- if (mpt->mandatory) {
- PLOG_W("mount('%s', flags:%s)", mpt->dst, mountFlagsToStr(new_flags));
- return false;
- }
- PLOG_D("mount('%s', flags:%s)", mpt->dst, mountFlagsToStr(new_flags));
+ PLOG_W("mount('%s', flags:%s)", mpt->dst, mountFlagsToStr(new_flags));
+ return false;
}
return true;
struct mounts_t *p;
TAILQ_FOREACH(p, &nsjconf->mountpts, pointers) {
- if (mountMount(p, destdir, tmpdir) == false) {
+ if (mountMount(p, destdir, tmpdir) == false && p->mandatory) {
return false;
}
}
}
TAILQ_FOREACH(p, &nsjconf->mountpts, pointers) {
- if (mountRemountRO(p) == false) {
+ if (mountRemountRO(p) == false && p->mandatory) {
return false;
}
}
int prev_dir_fd = open("/", O_RDONLY | O_CLOEXEC);
if (prev_dir_fd == -1) {
- PLOG_E("open('/', O_RDONLY | O_CLOEXEC)");
+ PLOG_W("open('/', O_RDONLY | O_CLOEXEC)");
return false;
}
*next = '\0';
if (mkdirat(prev_dir_fd, curr, 0755) == -1 && errno != EEXIST) {
- PLOG_E("mkdir('%s', 0755)", curr);
+ PLOG_W("mkdir('%s', 0755)", curr);
close(prev_dir_fd);
return false;
}
int dir_fd = TEMP_FAILURE_RETRY(openat(prev_dir_fd, curr, O_DIRECTORY | O_CLOEXEC));
if (dir_fd == -1) {
- PLOG_E("openat('%d', '%s', O_DIRECTORY | O_CLOEXEC)", prev_dir_fd, curr);
+ PLOG_W("openat('%d', '%s', O_DIRECTORY | O_CLOEXEC)", prev_dir_fd, curr);
close(prev_dir_fd);
return false;
}