Commit 24603033 authored by Nirbhay Choubey's avatar Nirbhay Choubey

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.
parent 848d1166
......@@ -672,6 +672,7 @@ extern my_bool has_path(const char *name);
extern char *convert_dirname(char *to, const char *from, const char *from_end);
extern void to_unix_path(char * name);
extern char * fn_ext(const char *name);
extern char * fn_ext2(const char *name);
extern char * fn_same(char * toname,const char *name,int flag);
extern char * fn_format(char * to,const char *name,const char *dir,
const char *form, uint flag);
......
......@@ -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++)
......
......@@ -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 */
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment