summaryrefslogtreecommitdiff
path: root/ext/mysql/libmysql/my_init.c
diff options
context:
space:
mode:
authorMySQL Team <mysql@php.net>2001-01-23 16:48:50 +0000
committerMySQL Team <mysql@php.net>2001-01-23 16:48:50 +0000
commit800f555b707c696798877c80352ded46289e87c4 (patch)
treec540242b6e6da4e9b99b46797a26b215abef0a64 /ext/mysql/libmysql/my_init.c
parentd36858681a0d48414702524ebd16f31289b06fa8 (diff)
downloadphp-git-800f555b707c696798877c80352ded46289e87c4.tar.gz
Upgrade ext/mysql/libmysql to version 3.23.32. One notable bug fix is
that the client can now connect to a server which is using a default charset other than latin1.
Diffstat (limited to 'ext/mysql/libmysql/my_init.c')
-rw-r--r--ext/mysql/libmysql/my_init.c20
1 files changed, 18 insertions, 2 deletions
diff --git a/ext/mysql/libmysql/my_init.c b/ext/mysql/libmysql/my_init.c
index 4955ae8090..fb9b2ae100 100644
--- a/ext/mysql/libmysql/my_init.c
+++ b/ext/mysql/libmysql/my_init.c
@@ -33,6 +33,19 @@ static my_bool win32_init_tcp_ip();
#endif
static my_bool my_init_done=0;
+
+static 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)
@@ -59,10 +72,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 */
@@ -138,6 +153,7 @@ void my_end(int infoflag)
if (have_tcpip);
WSACleanup( );
#endif /* __WIN__ */
+ my_init_done=0;
} /* my_end */
#ifdef __WIN__