diff options
author | unknown <petr@mysql.com> | 2005-04-14 01:39:24 +0400 |
---|---|---|
committer | unknown <petr@mysql.com> | 2005-04-14 01:39:24 +0400 |
commit | 82231c24c482f740452091b68751341b19060135 (patch) | |
tree | dfa79c152c5c996bcf31263b3566c4e3aef1f343 | |
parent | a40ecb481848ee7536a07506e68c2856ebac56ab (diff) | |
download | mariadb-git-82231c24c482f740452091b68751341b19060135.tar.gz |
post review fix
mysys/default.c:
cleanup + check for the last line in the file in "!include" directive processing
-rw-r--r-- | mysys/default.c | 27 |
1 files changed, 18 insertions, 9 deletions
diff --git a/mysys/default.c b/mysys/default.c index 841a5f6004f..63323f15fd5 100644 --- a/mysys/default.c +++ b/mysys/default.c @@ -418,15 +418,16 @@ static int search_default_file_with_ext(DYNAMIC_ARRAY *args, MEM_ROOT *alloc, /* trim trailing whitespace from directory name */ end= ptr + strlen(ptr) - 1; - /* - This would work fine even if no whitespaces are met - since fgets() stores the newline character in the buffer - */ - for (; my_isspace(&my_charset_latin1, *(end - 1)); end--) - {} - end[0]= 0; + /* fgets() stores the newline character in the buffer */ + if ((end[0] == '\n') || (end[0] == '\r') || + my_isspace(&my_charset_latin1, end[0])) + { + for (; my_isspace(&my_charset_latin1, *(end - 1)); end--) + {} + end[0]= 0; + } - /* print error msg if there is nothing after !inludedir directive */ + /* print error msg if there is nothing after !includedir directive */ if (end == ptr) { fprintf(stderr, @@ -444,7 +445,7 @@ static int search_default_file_with_ext(DYNAMIC_ARRAY *args, MEM_ROOT *alloc, search_file= search_dir->dir_entry + i; ext= fn_ext(search_file->name); - /* check extenstion */ + /* check extension */ for (tmp_ext= (char**) f_extensions; *tmp_ext; *tmp_ext++) { if (!strcmp(ext, *tmp_ext)) @@ -496,6 +497,14 @@ static int search_default_file_with_ext(DYNAMIC_ARRAY *args, MEM_ROOT *alloc, continue; } + else + if (recursion_level >= max_recursion_level) + { + fprintf(stderr, + "warning: skipping !include directive as maximum include" + "recursion level was reached in file %s at line %d\n", + name, line); + } if (*ptr == '[') /* Group name */ { |