mirror of
https://github.com/MariaDB/server.git
synced 2025-07-30 16:24:05 +03:00
more refinement of IM patch to fix Windows pathnames with spaces
server-tools/instance-manager/instance_options.cc: move declaration of end to start of function so gcc is happy server-tools/instance-manager/parse_output.cc: remove space before = use my_isspace to determine if *end is white space remove comments related to get_word which was removed replace tab character with appropriate # of spaces
This commit is contained in:
@ -334,12 +334,13 @@ int Instance_options::complete_initialization(const char *default_path,
|
|||||||
uint instance_type)
|
uint instance_type)
|
||||||
{
|
{
|
||||||
const char *tmp;
|
const char *tmp;
|
||||||
|
char* end;
|
||||||
|
|
||||||
if (!mysqld_path && !(mysqld_path= strdup_root(&alloc, default_path)))
|
if (!mysqld_path && !(mysqld_path= strdup_root(&alloc, default_path)))
|
||||||
goto err;
|
goto err;
|
||||||
|
|
||||||
// it's safe to cast this to char* since this is a buffer we are allocating
|
// it's safe to cast this to char* since this is a buffer we are allocating
|
||||||
char* end= convert_dirname((char*)mysqld_path, mysqld_path, NullS);
|
end= convert_dirname((char*)mysqld_path, mysqld_path, NullS);
|
||||||
end[-1]= 0;
|
end[-1]= 0;
|
||||||
|
|
||||||
mysqld_path_len= strlen(mysqld_path);
|
mysqld_path_len= strlen(mysqld_path);
|
||||||
|
@ -26,14 +26,14 @@
|
|||||||
|
|
||||||
void trim_space(const char **text, uint *word_len)
|
void trim_space(const char **text, uint *word_len)
|
||||||
{
|
{
|
||||||
const char* start = *text;
|
const char* start= *text;
|
||||||
while (*start != 0 && *start == ' ')
|
while (*start != 0 && *start == ' ')
|
||||||
start++;
|
start++;
|
||||||
*text= start;
|
*text= start;
|
||||||
|
|
||||||
int len= strlen(start);
|
int len= strlen(start);
|
||||||
const char* end= start + len - 1;
|
const char* end= start + len - 1;
|
||||||
while (end > start && (*end == ' ' || *end == '\r' || *end == '\n'))
|
while (end > start && my_isspace(&my_charset_latin1, *end))
|
||||||
end--;
|
end--;
|
||||||
*word_len= (end - start)+1;
|
*word_len= (end - start)+1;
|
||||||
}
|
}
|
||||||
@ -96,19 +96,17 @@ int parse_output_and_get_value(const char *command, const char *word,
|
|||||||
linebuf[sizeof(linebuf) - 1]= '\0'; /* safety */
|
linebuf[sizeof(linebuf) - 1]= '\0'; /* safety */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Get the word, which might contain non-alphanumeric characters. (Usually
|
Compare the start of our line with the word(s) we are looking for.
|
||||||
these are '/', '-' and '.' in the path expressions and filenames)
|
|
||||||
*/
|
*/
|
||||||
if (!strncmp(word, linep, wordlen))
|
if (!strncmp(word, linep, wordlen))
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
If we have found the word, return the next one (this is usually
|
If we have found our word(s), then move linep past the word(s)
|
||||||
an option value) or the whole line (if flag)
|
|
||||||
*/
|
*/
|
||||||
linep+= wordlen; /* swallow the previous one */
|
linep+= wordlen;
|
||||||
if (flag & GET_VALUE)
|
if (flag & GET_VALUE)
|
||||||
{
|
{
|
||||||
trim_space((const char**) &linep, &found_word_len);
|
trim_space((const char**) &linep, &found_word_len);
|
||||||
if (input_buffer_len <= found_word_len)
|
if (input_buffer_len <= found_word_len)
|
||||||
goto err;
|
goto err;
|
||||||
strmake(result, linep, found_word_len);
|
strmake(result, linep, found_word_len);
|
||||||
|
Reference in New Issue
Block a user