diff options
author | monty@donna.mysql.com <> | 2000-09-26 02:57:29 +0300 |
---|---|---|
committer | monty@donna.mysql.com <> | 2000-09-26 02:57:29 +0300 |
commit | c079bfc04e0e65f9d5d95449e4196f19d7c14b28 (patch) | |
tree | bb421f15c229afe4917e309ee23edd41a9f50bff /mysys/my_init.c | |
parent | e32799e4ddeb03362d5740ac4f3ce5a9e4627ea0 (diff) | |
download | mariadb-git-c079bfc04e0e65f9d5d95449e4196f19d7c14b28.tar.gz |
Small fixes
Diffstat (limited to 'mysys/my_init.c')
-rw-r--r-- | mysys/my_init.c | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/mysys/my_init.c b/mysys/my_init.c index 912e80d9ebd..4e7d1b6b2db 100644 --- a/mysys/my_init.c +++ b/mysys/my_init.c @@ -47,6 +47,19 @@ static my_bool win32_init_tcp_ip(); #endif static my_bool my_init_done=0; + +ulong atoi_octal(const char *str) +{ + long int tmp; + while (*str && isspace(*str)) + str++; + str2int(str, + (*str == '0' ? 8 : 10), /* Octalt or decimalt */ + 0, INT_MAX, &tmp); + return (ulong) tmp; +} + + /* Init my_sys functions and my_sys variabels */ void my_init(void) @@ -73,10 +86,12 @@ void my_init(void) if ((home_dir=getenv("HOME")) != 0) home_dir=intern_filename(home_dir_buff,home_dir); #ifndef VMS + /* Default creation of new files */ if ((str=getenv("UMASK")) != 0) - my_umask=atoi(str) | 0600; /* Default creation of new files */ + my_umask=(int) (atoi_octal(str) | 0600); + /* Default creation of new dir's */ if ((str=getenv("UMASK_DIR")) != 0) - my_umask_dir=atoi(str) | 0700; /* Default creation of new dir's */ + my_umask_dir=(int) (atoi_octal(str) | 0700); #endif #ifdef VMS init_ctype(); /* Stupid linker don't link _ctype.c */ |