Skip to content

Commit 24989bf

Browse files
committed
mount: find bind in the options
the OCI specifications say that "bind" or "rbind" are specified in the options. Signed-off-by: Giuseppe Scrivano <[email protected]>
1 parent f6f96ee commit 24989bf

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

src/libcrun/linux.c

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -872,13 +872,30 @@ do_mounts (libcrun_container *container, const char *rootfs, libcrun_error_t *er
872872
else
873873
{
874874
size_t j;
875+
875876
for (j = 0; j < def->mounts[i]->options_len; j++)
876877
{
877878
flags |= get_mount_flags_or_option (def->mounts[i]->options[j], flags, &data);
878879
}
879880
}
880881

881882
type = def->mounts[i]->type;
883+
if (type == NULL)
884+
{
885+
size_t j;
886+
887+
for (j = 0; j < def->mounts[i]->options_len; j++)
888+
{
889+
if (strcmp (def->mounts[i]->options[j], "bind") == 0 || strcmp (def->mounts[i]->options[j], "rbind") == 0)
890+
{
891+
type = "bind";
892+
break;
893+
}
894+
}
895+
}
896+
if (type == NULL)
897+
return crun_make_error (err, 0, "invalid mount type for %s", def->mounts[i]->destination);
898+
882899

883900
if (strcmp (type, "bind") == 0)
884901
{

0 commit comments

Comments
 (0)