[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Minios-devel] [UNIKRAFT PATCH v3 2/5] lib/vfscore: fs_getfs(): Return NULL on failed lookup
Mount never failed when the filesystem name was incorrect. This was due to the vfscore-internal function fs_getfs() that returned the last registered filesystem instead of NULL whenever the name was invalid. Signed-off-by: Simon Kuenzer <simon.kuenzer@xxxxxxxxx> --- lib/vfscore/mount.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/lib/vfscore/mount.c b/lib/vfscore/mount.c index 2629d132..9d7ace15 100644 --- a/lib/vfscore/mount.c +++ b/lib/vfscore/mount.c @@ -80,17 +80,18 @@ fs_getfs(const char *name) { const struct vfscore_fs_type *fs = NULL, **__fs; + UK_ASSERT(name != NULL); + for_each_fs(__fs) { fs = *__fs; - if (fs == NULL) + if (!fs || !fs->vs_name) continue; - if (!strncmp(name, fs->vs_name, FSMAXNAMES)) - break; + if (strncmp(name, fs->vs_name, FSMAXNAMES) == 0) + return fs; } - if (!fs || !fs->vs_name) - return NULL; - return fs; + + return NULL; } int device_open(const char *name __unused, int mode __unused, -- 2.20.1 _______________________________________________ Minios-devel mailing list Minios-devel@xxxxxxxxxxxxxxxxxxxx https://lists.xenproject.org/mailman/listinfo/minios-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |