lkml.org 
[lkml]   [2021]   [Aug]   [8]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Subject[RFC PATCH 06/20] ntfs: Fix error processing when load_nls() fails
    Date
    Ensure that specified charset in iocharset= mount option is used. On error
    correctly propagate error code back to the caller.

    Signed-off-by: Pali Rohár <pali@kernel.org>
    ---
    fs/ntfs/super.c | 18 +++++-------------
    1 file changed, 5 insertions(+), 13 deletions(-)

    diff --git a/fs/ntfs/super.c b/fs/ntfs/super.c
    index 02de1aa05b7c..69c7871b742e 100644
    --- a/fs/ntfs/super.c
    +++ b/fs/ntfs/super.c
    @@ -94,7 +94,7 @@ static bool parse_options(ntfs_volume *vol, char *opt)
    umode_t fmask = (umode_t)-1, dmask = (umode_t)-1;
    int mft_zone_multiplier = -1, on_errors = -1;
    int show_sys_files = -1, case_sensitive = -1, disable_sparse = -1;
    - struct nls_table *nls_map = NULL, *old_nls;
    + struct nls_table *nls_map = NULL;

    /* I am lazy... (-8 */
    #define NTFS_GETOPT_WITH_DEFAULT(option, variable, default_value) \
    @@ -195,20 +195,12 @@ static bool parse_options(ntfs_volume *vol, char *opt)
    if (!v || !*v)
    goto needs_arg;
    use_utf8:
    - old_nls = nls_map;
    + unload_nls(nls_map);
    nls_map = load_nls(v);
    if (!nls_map) {
    - if (!old_nls) {
    - ntfs_error(vol->sb, "NLS character set "
    - "%s not found.", v);
    - return false;
    - }
    - ntfs_error(vol->sb, "NLS character set %s not "
    - "found. Using previous one %s.",
    - v, old_nls->charset);
    - nls_map = old_nls;
    - } else /* nls_map */ {
    - unload_nls(old_nls);
    + ntfs_error(vol->sb, "NLS character set "
    + "%s not found.", v);
    + return false;
    }
    } else if (!strcmp(p, "utf8")) {
    bool val = false;
    --
    2.20.1
    \
     
     \ /
      Last update: 2021-08-08 18:26    [W:2.085 / U:0.232 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site