kernel: Make the filename restrictions configurable
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
parent
3d157b760c
commit
fdf2bb2501
@ -10,3 +10,8 @@
|
|||||||
|
|
||||||
# Example: Adding a compiler flag. This will optimize the kernel aggressively (warning: untested, use at your own discretion).
|
# Example: Adding a compiler flag. This will optimize the kernel aggressively (warning: untested, use at your own discretion).
|
||||||
# target_compile_options(moon PRIVATE -O3)
|
# target_compile_options(moon PRIVATE -O3)
|
||||||
|
|
||||||
|
# Uncomment the line below to allow any filename on file/directory creation (by default, the kernel prohibits filenames with
|
||||||
|
# control characters, leading/trailing spaces, problematic characters and invalid UTF-8). Keep in mind that this restriction
|
||||||
|
# is only enforced when creating files; existing files with such illegal filenames are parsed correctly and fully usable.
|
||||||
|
# target_compile_definitions(moon PRIVATE MOON_DISABLE_FILENAME_RESTRICTIONS)
|
||||||
|
@ -101,6 +101,10 @@ namespace VFS
|
|||||||
|
|
||||||
Result<void> validate_filename(StringView name)
|
Result<void> validate_filename(StringView name)
|
||||||
{
|
{
|
||||||
|
#ifdef MOON_DISABLE_FILENAME_RESTRICTIONS
|
||||||
|
return {};
|
||||||
|
#endif
|
||||||
|
|
||||||
// Forbid problematic characters that could cause trouble in shell scripts and the like.
|
// Forbid problematic characters that could cause trouble in shell scripts and the like.
|
||||||
if (strpbrk(name.chars(), "*?:[]\"<>\\")) return err(EINVAL);
|
if (strpbrk(name.chars(), "*?:[]\"<>\\")) return err(EINVAL);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user