diff options
author | Nirbhay Choubey <nirbhay@mariadb.com> | 2014-10-29 22:20:58 -0400 |
---|---|---|
committer | Nirbhay Choubey <nirbhay@mariadb.com> | 2014-10-29 22:20:58 -0400 |
commit | 24603033e3249e266bd27cbfbc50b7c2517ec6a6 (patch) | |
tree | 498bff609059c4d1bca673e8e9183bbe966dab73 /mysys | |
parent | 848d1166b648d8c409edb98b506e7bf3bfe469e4 (diff) | |
download | mariadb-git-24603033e3249e266bd27cbfbc50b7c2517ec6a6.tar.gz |
MDEV-6939 : Dots in file names of configuration files
Use fn_ext2() (backported from 10.0) to get the file
extension from last occurrence of FN_EXTCHAR ('.')
instead.
Diffstat (limited to 'mysys')
-rw-r--r-- | mysys/default.c | 2 | ||||
-rw-r--r-- | mysys/mf_fn_ext.c | 43 |
2 files changed, 42 insertions, 3 deletions
diff --git a/mysys/default.c b/mysys/default.c index 08653b1a3c4..f23594736d6 100644 --- a/mysys/default.c +++ b/mysys/default.c @@ -849,7 +849,7 @@ static int search_default_file_with_ext(Process_option_func opt_handler, for (i= 0; i < (uint) search_dir->number_off_files; i++) { search_file= search_dir->dir_entry + i; - ext= fn_ext(search_file->name); + ext= fn_ext2(search_file->name); /* check extension */ for (tmp_ext= (char**) f_extensions; *tmp_ext; tmp_ext++) diff --git a/mysys/mf_fn_ext.c b/mysys/mf_fn_ext.c index 47fc67cabbd..b78d73074da 100644 --- a/mysys/mf_fn_ext.c +++ b/mysys/mf_fn_ext.c @@ -29,7 +29,7 @@ (normally '.') after the directory name. RETURN VALUES - Pointer to to the extension character. If there isn't any extension, + Pointer to the extension character. If there isn't any extension, points at the end ASCII(0) of the filename. */ @@ -49,6 +49,45 @@ char *fn_ext(const char *name) if (!(gpos= strrchr(name, FN_LIBCHAR))) gpos= name; #endif - pos=strchr(gpos,FN_EXTCHAR); + pos= strchr(gpos, FN_EXTCHAR); DBUG_RETURN((char*) (pos ? pos : strend(gpos))); } /* fn_ext */ + + +/* + Return a pointer to the extension of the filename. + + SYNOPSIS + fn_ext2() + name Name of file + + DESCRIPTION + The extension is defined as everything after the last extension character + (normally '.') after the directory name. + + RETURN VALUES + Pointer to the extension character. If there isn't any extension, + points at the end ASCII(0) of the filename. +*/ + +char *fn_ext2(const char *name) +{ + register const char *pos, *gpos; + DBUG_ENTER("fn_ext"); + DBUG_PRINT("mfunkt",("name: '%s'",name)); + +#if defined(FN_DEVCHAR) || defined(BASKSLASH_MBTAIL) + { + char buff[FN_REFLEN]; + size_t res_length; + gpos= name+ dirname_part(buff,(char*) name, &res_length); + } +#else + if (!(gpos= strrchr(name, FN_LIBCHAR))) + gpos= name; +#endif + // locate the last occurence of FN_EXTCHAR + pos= strrchr(gpos, FN_EXTCHAR); + DBUG_RETURN((char*) (pos ? pos : strend(gpos))); +} /* fn_ext2 */ + |