Commit c24e0fcc authored by monty@narttu.mysql.fi's avatar monty@narttu.mysql.fi

Merge bk-internal.mysql.com:/home/bk/mysql-4.0

into narttu.mysql.fi:/my/mysql-4.0
parents 38120235 20a1226c
...@@ -26,6 +26,7 @@ ...@@ -26,6 +26,7 @@
#include <my_getopt.h> #include <my_getopt.h>
const char *config_file="my"; /* Default config file */ const char *config_file="my"; /* Default config file */
uint verbose= 0, opt_defaults_file_used= 0;
static struct my_option my_long_options[] = static struct my_option my_long_options[] =
{ {
...@@ -47,6 +48,8 @@ static struct my_option my_long_options[] = ...@@ -47,6 +48,8 @@ static struct my_option my_long_options[] =
0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
{"help", '?', "Display this help message and exit.", {"help", '?', "Display this help message and exit.",
0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
{"verbose", 'v', "Increase the output level",
0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
{"version", 'V', "Output version information and exit.", {"version", 'V', "Output version information and exit.",
0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0} {0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}
...@@ -55,7 +58,7 @@ static struct my_option my_long_options[] = ...@@ -55,7 +58,7 @@ static struct my_option my_long_options[] =
static void usage(my_bool version) static void usage(my_bool version)
{ {
printf("%s Ver 1.5 for %s at %s\n",my_progname,SYSTEM_TYPE, printf("%s Ver 1.6 for %s at %s\n",my_progname,SYSTEM_TYPE,
MACHINE_TYPE); MACHINE_TYPE);
if (version) if (version)
return; return;
...@@ -73,12 +76,18 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)), ...@@ -73,12 +76,18 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
char *argument __attribute__((unused))) char *argument __attribute__((unused)))
{ {
switch (optid) { switch (optid) {
case 'c':
opt_defaults_file_used= 1;
break;
case 'n': case 'n':
exit(0); exit(0);
case 'I': case 'I':
case '?': case '?':
usage(0); usage(0);
exit(0); exit(0);
case 'v':
verbose++;
break;
case 'V': case 'V':
usage(1); usage(1);
exit(0); exit(0);
...@@ -104,7 +113,7 @@ static int get_options(int *argc,char ***argv) ...@@ -104,7 +113,7 @@ static int get_options(int *argc,char ***argv)
int main(int argc, char **argv) int main(int argc, char **argv)
{ {
int count; int count, error;
char **load_default_groups, *tmp_arguments[2], char **load_default_groups, *tmp_arguments[2],
**argument, **arguments; **argument, **arguments;
MY_INIT(argv[0]); MY_INIT(argv[0]);
...@@ -126,8 +135,20 @@ int main(int argc, char **argv) ...@@ -126,8 +135,20 @@ int main(int argc, char **argv)
arguments=tmp_arguments; arguments=tmp_arguments;
arguments[0]=my_progname; arguments[0]=my_progname;
arguments[1]=0; arguments[1]=0;
load_defaults(config_file, (const char **) load_default_groups, if ((error= load_defaults(config_file, (const char **) load_default_groups,
&count, &arguments); &count, &arguments)) > 1)
{
if (verbose && opt_defaults_file_used)
{
if (error == 2)
fprintf(stderr, "WARNING: Defaults file (%s) not found!\n",
config_file);
if (error == 3)
fprintf(stderr, "WARNING: Defaults file (%s) is not a regular file!\n",
config_file);
}
exit(2); // Non-fatal error
}
for (argument= arguments+1 ; *argument ; argument++) for (argument= arguments+1 ; *argument ; argument++)
puts(*argument); puts(*argument);
......
...@@ -742,7 +742,7 @@ extern void set_prealloc_root(MEM_ROOT *root, char *ptr); ...@@ -742,7 +742,7 @@ extern void set_prealloc_root(MEM_ROOT *root, char *ptr);
extern char *strdup_root(MEM_ROOT *root,const char *str); extern char *strdup_root(MEM_ROOT *root,const char *str);
extern char *strmake_root(MEM_ROOT *root,const char *str,uint len); extern char *strmake_root(MEM_ROOT *root,const char *str,uint len);
extern char *memdup_root(MEM_ROOT *root,const char *str,uint len); extern char *memdup_root(MEM_ROOT *root,const char *str,uint len);
extern void load_defaults(const char *conf_file, const char **groups, extern int load_defaults(const char *conf_file, const char **groups,
int *argc, char ***argv); int *argc, char ***argv);
extern void free_defaults(char **argv); extern void free_defaults(char **argv);
extern void print_defaults(const char *conf_file, const char **groups); extern void print_defaults(const char *conf_file, const char **groups);
......
...@@ -242,7 +242,7 @@ void hash_password(unsigned long *result, const char *password); ...@@ -242,7 +242,7 @@ void hash_password(unsigned long *result, const char *password);
/* Some other useful functions */ /* Some other useful functions */
void my_init(void); void my_init(void);
void load_defaults(const char *conf_file, const char **groups, int load_defaults(const char *conf_file, const char **groups,
int *argc, char ***argv); int *argc, char ***argv);
my_bool my_thread_init(void); my_bool my_thread_init(void);
void my_thread_end(void); void my_thread_end(void);
......
...@@ -66,13 +66,13 @@ NullS, ...@@ -66,13 +66,13 @@ NullS,
#define windows_ext ".ini" #define windows_ext ".ini"
#endif #endif
static my_bool search_default_file(DYNAMIC_ARRAY *args,MEM_ROOT *alloc, static int search_default_file(DYNAMIC_ARRAY *args,MEM_ROOT *alloc,
const char *dir, const char *config_file, const char *dir, const char *config_file,
const char *ext, TYPELIB *group); const char *ext, TYPELIB *group);
static char *remove_end_comment(char *ptr); static char *remove_end_comment(char *ptr);
void load_defaults(const char *conf_file, const char **groups, int load_defaults(const char *conf_file, const char **groups,
int *argc, char ***argv) int *argc, char ***argv)
{ {
DYNAMIC_ARRAY args; DYNAMIC_ARRAY args;
...@@ -80,6 +80,7 @@ void load_defaults(const char *conf_file, const char **groups, ...@@ -80,6 +80,7 @@ void load_defaults(const char *conf_file, const char **groups,
TYPELIB group; TYPELIB group;
my_bool found_print_defaults=0; my_bool found_print_defaults=0;
uint args_used=0; uint args_used=0;
int error= 0;
MEM_ROOT alloc; MEM_ROOT alloc;
char *ptr,**res; char *ptr,**res;
DBUG_ENTER("load_defaults"); DBUG_ENTER("load_defaults");
...@@ -100,7 +101,7 @@ void load_defaults(const char *conf_file, const char **groups, ...@@ -100,7 +101,7 @@ void load_defaults(const char *conf_file, const char **groups,
(*argc)--; (*argc)--;
*argv=res; *argv=res;
*(MEM_ROOT*) ptr= alloc; /* Save alloc root for free */ *(MEM_ROOT*) ptr= alloc; /* Save alloc root for free */
DBUG_VOID_RETURN; return 0;
} }
/* Check if we want to force the use a specific default file */ /* Check if we want to force the use a specific default file */
...@@ -129,14 +130,14 @@ void load_defaults(const char *conf_file, const char **groups, ...@@ -129,14 +130,14 @@ void load_defaults(const char *conf_file, const char **groups,
goto err; goto err;
if (forced_default_file) if (forced_default_file)
{ {
if (search_default_file(&args, &alloc, "", forced_default_file, "", if ((error= search_default_file(&args, &alloc, "",
&group)) forced_default_file, "", &group)) == 1)
goto err; goto err;
} }
else if (dirname_length(conf_file)) else if (dirname_length(conf_file))
{ {
if (search_default_file(&args, &alloc, NullS, conf_file, default_ext, if ((error= search_default_file(&args, &alloc, NullS, conf_file,
&group)) default_ext, &group)) == 1)
goto err; goto err;
} }
else else
...@@ -144,26 +145,25 @@ void load_defaults(const char *conf_file, const char **groups, ...@@ -144,26 +145,25 @@ void load_defaults(const char *conf_file, const char **groups,
#ifdef __WIN__ #ifdef __WIN__
char system_dir[FN_REFLEN]; char system_dir[FN_REFLEN];
GetWindowsDirectory(system_dir,sizeof(system_dir)); GetWindowsDirectory(system_dir,sizeof(system_dir));
if (search_default_file(&args, &alloc, system_dir, conf_file, windows_ext, if ((error= search_default_file(&args, &alloc, system_dir, conf_file,
&group)) windows_ext, &group)) == 1)
goto err; goto err;
#endif #endif
#if defined(__EMX__) || defined(OS2) #if defined(__EMX__) || defined(OS2)
if (getenv("ETC") && if (getenv("ETC") &&
search_default_file(&args, &alloc, getenv("ETC"), conf_file, (error= search_default_file(&args, &alloc, getenv("ETC"), conf_file,
default_ext, &group)) default_ext, &group)) == 1)
goto err; goto err;
#endif #endif
for (dirs=default_directories ; *dirs; dirs++) for (dirs=default_directories ; *dirs; dirs++)
{ {
int error=0;
if (**dirs) if (**dirs)
error=search_default_file(&args, &alloc, *dirs, conf_file, error= search_default_file(&args, &alloc, *dirs, conf_file,
default_ext, &group); default_ext, &group);
else if (defaults_extra_file) else if (defaults_extra_file)
error=search_default_file(&args, &alloc, NullS, defaults_extra_file, error= search_default_file(&args, &alloc, NullS, defaults_extra_file,
default_ext, &group); default_ext, &group);
if (error) if (error == 1)
goto err; goto err;
} }
} }
...@@ -204,11 +204,11 @@ void load_defaults(const char *conf_file, const char **groups, ...@@ -204,11 +204,11 @@ void load_defaults(const char *conf_file, const char **groups,
puts(""); puts("");
exit(1); exit(1);
} }
DBUG_VOID_RETURN; return error;
err: err:
fprintf(stderr,"Program aborted\n"); fprintf(stderr,"Program aborted\n");
exit(1); return(error);
} }
...@@ -220,7 +220,14 @@ void free_defaults(char **argv) ...@@ -220,7 +220,14 @@ void free_defaults(char **argv)
} }
static my_bool search_default_file(DYNAMIC_ARRAY *args, MEM_ROOT *alloc, /*
Return values: 0 Success
1 Fatal error, abort
2 File not found, continue
3 File is not a regular file, continue
*/
static int search_default_file(DYNAMIC_ARRAY *args, MEM_ROOT *alloc,
const char *dir, const char *config_file, const char *dir, const char *config_file,
const char *ext, TYPELIB *group) const char *ext, TYPELIB *group)
{ {
...@@ -247,7 +254,7 @@ static my_bool search_default_file(DYNAMIC_ARRAY *args, MEM_ROOT *alloc, ...@@ -247,7 +254,7 @@ static my_bool search_default_file(DYNAMIC_ARRAY *args, MEM_ROOT *alloc,
{ {
MY_STAT stat_info; MY_STAT stat_info;
if (!my_stat(name,&stat_info,MYF(0))) if (!my_stat(name,&stat_info,MYF(0)))
return 0; return 2;
/* /*
Ignore world-writable regular files. Ignore world-writable regular files.
This is mainly done to protect us to not read a file created by This is mainly done to protect us to not read a file created by
...@@ -260,6 +267,8 @@ static my_bool search_default_file(DYNAMIC_ARRAY *args, MEM_ROOT *alloc, ...@@ -260,6 +267,8 @@ static my_bool search_default_file(DYNAMIC_ARRAY *args, MEM_ROOT *alloc,
name); name);
return 0; return 0;
} }
else if ((stat_info.st_mode & S_IFMT) != S_IFREG)
return 3;
} }
#endif #endif
if (!(fp = my_fopen(fn_format(name,name,"","",4),O_RDONLY,MYF(0)))) if (!(fp = my_fopen(fn_format(name,name,"","",4),O_RDONLY,MYF(0))))
......
...@@ -148,7 +148,7 @@ else ...@@ -148,7 +148,7 @@ else
fi fi
args= args=
parse_arguments `$print_defaults $defaults mysqld server mysqld_safe safe_mysqld` parse_arguments `$print_defaults --loose-verbose $defaults mysqld server mysqld_safe safe_mysqld`
parse_arguments PICK-ARGS-FROM-ARGV "$@" parse_arguments PICK-ARGS-FROM-ARGV "$@"
if test ! -x $ledir/$MYSQLD if test ! -x $ledir/$MYSQLD
......
...@@ -219,23 +219,23 @@ ...@@ -219,23 +219,23 @@
"Não pode acrescentar uma restrição de chave estrangeira", "Não pode acrescentar uma restrição de chave estrangeira",
"Não pode acrescentar uma linha filha: uma restrição de chave estrangeira falhou", "Não pode acrescentar uma linha filha: uma restrição de chave estrangeira falhou",
"Não pode apagar uma linha pai: uma restrição de chave estrangeira falhou", "Não pode apagar uma linha pai: uma restrição de chave estrangeira falhou",
"Error connecting to master: %-.128s", "Erro conectando com o master: %-.128s",
"Error running query on master: %-.128s", "Erro rodando consulta no master: %-.128s",
"Error when executing command %s: %-.128s", "Erro quando executando comando %s: %-.128s",
"Wrong usage of %s and %s", "Uso errado de %s e %s",
"The used SELECT statements have a different number of columns", "Os comandos SELECT usados têm diferente número de colunas",
"Can't execute the query because you have a conflicting read lock", "Não posso executar a consulta porque você tem um conflito de travamento de leitura",
"Mixing of transactional and non-transactional tables is disabled", "Mistura de tabelas transacional e não-transacional está desabilitada",
"Option '%s' used twice in statement", "Opção '%s' usada duas vezes no comando",
"User '%-.64s' has exceeded the '%s' resource (current value: %ld)", "Usuário '%-.64s' tem excedido o '%s' recurso (atual valor: %ld)",
"Access denied. You need the %-.128s privilege for this operation", "Acesso negado. Você precisa o privilégio %-.128s para essa operação",
"Variable '%-.64s' is a LOCAL variable and can't be used with SET GLOBAL", "Variável '%-.64s' é uma LOCAL variável e não pode ser usada com SET GLOBAL",
"Variable '%-.64s' is a GLOBAL variable and should be set with SET GLOBAL", "Variável '%-.64s' é uma GLOBAL variável e deve ser configurada com SET GLOBAL",
"Variable '%-.64s' doesn't have a default value", "Variável '%-.64s' não tem um valor padrão",
"Variable '%-.64s' can't be set to the value of '%-.64s'", "Variável '%-.64s' não pode ser configurada para o valor de '%-.64s'",
"Wrong argument type to variable '%-.64s'", "Tipo errado de argumento para variável '%-.64s'",
"Variable '%-.64s' can only be set, not read", "Variável '%-.64s' somente pode ser configurada, não lida",
"Wrong usage/placement of '%s'", "Errado uso/colocação de '%s'",
"This version of MySQL doesn't yet support '%s'", "Esta versão de MySQL não suporta ainda '%s'",
"Got fatal error %d: '%-.128s' from master when reading data from binary log", "Obteve fatal erro %d: '%-.128s' do master quando lendo dados do binary log",
"Slave SQL thread ignored the query because of replicate-*-table rules" "Slave SQL thread ignorado a consulta devido às normas de replicação-*-tabela"
...@@ -223,20 +223,20 @@ ...@@ -223,20 +223,20 @@
"Error de coneccion a master: %-128s", "Error de coneccion a master: %-128s",
"Error executando el query en master: %-128%", "Error executando el query en master: %-128%",
"Error de %s: %-128%", "Error de %s: %-128%",
"Wrong usage of %s and %s", "Equivocado uso de %s y %s",
"The used SELECT statements have a different number of columns", "El comando SELECT usado tiene diferente número de columnas",
"Can't execute the query because you have a conflicting read lock", "No puedo ejecutar el query porque usted tiene conflicto de traba de lectura",
"Mixing of transactional and non-transactional tables is disabled", "Mezla de transancional y no-transancional tablas está deshabilitada",
"Option '%s' used twice in statement", "Opción '%s' usada dos veces en el comando",
"User '%-.64s' has exceeded the '%s' resource (current value: %ld)", "Usuario '%-.64s' ha excedido el recurso '%s' (actual valor: %ld)",
"Access denied. You need the %-.128s privilege for this operation", "Acceso negado. Usted necesita el privilegio %-.128s para esta operación",
"Variable '%-.64s' is a LOCAL variable and can't be used with SET GLOBAL", "Variable '%-.64s' es una LOCAL variable y no puede ser usada con SET GLOBAL",
"Variable '%-.64s' is a GLOBAL variable and should be set with SET GLOBAL", "Variable '%-.64s' es una GLOBAL variable y no puede ser configurada con SET GLOBAL",
"Variable '%-.64s' doesn't have a default value", "Variable '%-.64s' no tiene un valor patrón",
"Variable '%-.64s' can't be set to the value of '%-.64s'", "Variable '%-.64s' no puede ser configurada para el valor de '%-.64s'",
"Wrong argument type to variable '%-.64s'", "Tipo de argumento equivocado para variable '%-.64s'",
"Variable '%-.64s' can only be set, not read", "Variable '%-.64s' solamente puede ser configurada, no leída",
"Wrong usage/placement of '%s'", "Equivocado uso/colocación de '%s'",
"This version of MySQL doesn't yet support '%s'", "Esta versión de MySQL no soporta todavia '%s'",
"Got fatal error %d: '%-.128s' from master when reading data from binary log", "Recibió fatal error %d: '%-.128s' del master cuando leyendo datos del binary log",
"Slave SQL thread ignored the query because of replicate-*-table rules" "Slave SQL thread ignorado el query debido a las reglas de replicación-*-tabla"
...@@ -18,7 +18,7 @@ INCLUDES= -I$(srcdir)/../include -I../include $(openssl_includes) ...@@ -18,7 +18,7 @@ INCLUDES= -I$(srcdir)/../include -I../include $(openssl_includes)
LDADD= @CLIENT_EXTRA_LDFLAGS@ $(openssl_libs) LDADD= @CLIENT_EXTRA_LDFLAGS@ $(openssl_libs)
pkglib_LIBRARIES= libvio.a pkglib_LIBRARIES= libvio.a
noinst_PROGRAMS = test-ssl test-sslserver test-sslclient noinst_PROGRAMS = test-ssl test-sslserver test-sslclient
noinst_HEADERS= noinst_HEADERS= vio_priv.h
test_ssl_SOURCES= test-ssl.c test_ssl_SOURCES= test-ssl.c
test_ssl_LDADD= @CLIENT_EXTRA_LDFLAGS@ ../dbug/libdbug.a libvio.a \ test_ssl_LDADD= @CLIENT_EXTRA_LDFLAGS@ ../dbug/libdbug.a libvio.a \
../mysys/libmysys.a ../strings/libmystrings.a \ ../mysys/libmysys.a ../strings/libmystrings.a \
......
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