const struct lxc_rootfs *rootfs, FILE *file,
const char *lxc_name, const char *lxc_path)
{
- char buf[4096];
+ char buf[PATH_MAX];
struct mntent mntent;
- int ret = -1;
while (getmntent_r(file, &mntent, buf, sizeof(buf))) {
+ int ret;
+
if (!rootfs->path)
ret = mount_entry_on_systemfs(&mntent);
else if (mntent.mnt_dir[0] != '/')
lxc_name, lxc_path);
else
ret = mount_entry_on_absolute_rootfs(&mntent, rootfs,
- lxc_name, lxc_path);
+ lxc_name, lxc_path);
if (ret < 0)
return -1;
}
- ret = 0;
- INFO("Finished setting up mounts");
- return ret;
+ if (!feof(file) || ferror(file)) {
+ ERROR("Failed to parse mount entries");
+ return -1;
+ }
+
+ return 0;
}
static int setup_mount(const struct lxc_conf *conf,